Oracle Form URL with content root's children directories path?

Hi All
In this case , we try to add children directories under default form path ( ex: Oracle_FRHome1/forms/DEPT_001/xx001_01.fmx  and Oracle_FRHome1/forms/DEPT_002/xx002_01.fmx  )
but there are so many children directories in our legacy systems, so it's not possible for us to add all path in server form_path variable
We try to call form directly in url
such as : http://localhost:9001/forms/frmservlet?form=/DEPT_001/xx001_01.fmx
first error appeared with such error message : FRM-92190: JavaScript is unable to evaluate expression.
After confirm error message,  our form xx001_01.fmx still work fine
Are there any configuration file should be adjust in this case ?
Thanks~

Hi Tony
Thanks for your response.
In this case , we have to many difference directories in legacy system.
FORM_PATH must be under some maximum length restriction and may exceed max length in this scenario
Is is possible to change AliasMatch in forms.conf for url pattern matching ?
best regard
thanks
Hendry

Similar Messages

  • Oracle Forms Integration With MS AD

    Hi All,
    I google this topic but the material is totally confusing so can you please help me to complete the task.
    ENV
    Oracle 10R1 DB
    Oracle 10g forms and report services
    MS AD on 2003 server
    We want to use the same user name & password for apps login and Operating system user login that means to authenticate the oracle forms apps with MS AD.
    MY question
    1. Can DBMS_LADP help me to integrate ? If yes then please list down the steps ?
    2. Should i install complete apps server (Infra & apps) then syn OID and AD?
    If you have any good info/document ,please email me at [email protected]
    Regards,
    Edited by: user8848983 on Apr 1, 2011 2:14 AM

    Any One have Idea ?

  • How to connect oracle forms 6i with .odb database

    Hai,
    I need to connect oracle forms 6i with .odb database.
    What are the software i need to install.
    tell me the steps hoe to connect the oracle forms6i with .odb database

    I must say honestly that I got a little ticked when you have mentioned .odb is oracle lite.You should mention the complete name of the software whichever it may be as its not at all mandatory,everyone would know the acronym.
    Anyways,a quick search revealed this.
    Connect Forms 6i application to Oracle 10g Lite database on notebook
    I have not worked in Oracle lite at all.So I can't help much in it.But as per the thread,it wont be a straight connectivity.I would suggest you contact Support
    Aman....

  • Calling web service from oracle forms fails with ORA_JAVA.JAVA_ERROR

    Problem Description:
    I'm following the steps as per the doc:
    http://www.oracle.com/technology/products/forms/htdocs/10gr2/howto/webservicefromforms/ws_10_1_3_from_forms.html
    to create a java stub to call external web service and then use java importer in oracle forms to call this web service from oracle forms.
    WSDL for external web service used is http://www.webservicex.net/CurrencyConverter.asmx?wsdl
    Calling the web service using JDeveloper works fine but from Oracle Forms returns ORA_JAVA.JAVA_ERROR; Unable to call out to Java, Invalid object type for argument 1
    The code from oracle form to call web service is as below:
    DECLARE
    jo ora_java.jobject;
    rv ora_java.jobject;
    ex ora_java.jobject;
    outString varchar2(2000);
    BEGIN
    jo:= CurrencyConvertorStub.new;
    --This will get the exchange rate from US Dollars to UK Sterling.
    rv:= CurrencyConvertorStub.ConversionRate(jo,'CAD','USD');
    message (float_.floatValue(RV));
    EXCEPTION
    WHEN ORA_JAVA.JAVA_ERROR then
    message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
    WHEN ORA_JAVA.EXCEPTION_THROWN then
    ex := ORA_JAVA.LAST_EXCEPTION;
    outString := Exception_.toString(ex);
    message(outString);
    END;
    Any help/ideas on this is greatly appreciated. Thanks.

    Yes, it is the message line - so basically this call fails => rv:= CurrencyConvertorStub.ConversionRate(jo,'CAD','USD'); and control goes in the exception block
    WHEN ORA_JAVA.JAVA_ERROR then
    message('Unable to call out to Java, ' ||ORA_JAVA.LAST_ERROR);
    Below is the code from java stub that was generated using JDeveloper by using web services stub/skeleton and associating the WSDL
    public Double ConversionRate(String FromCurrency, String ToCurrency) throws Exception
    URL endpointURL = new URL(endpoint);
    Envelope requestEnv = new Envelope();
    Body requestBody = new Body();
    Vector requestBodyEntries = new Vector();
    String wrappingName = "ConversionRate";
    String targetNamespace = "http://www.webserviceX.NET/";
    Vector requestData = new Vector();
    requestData.add(new Object[] {"FromCurrency", FromCurrency});
    requestData.add(new Object[] {"ToCurrency", ToCurrency});
    requestBodyEntries.addElement(toElement(wrappingName, targetNamespace, requestData));
    requestBody.setBodyEntries(requestBodyEntries);
    requestEnv.setBody(requestBody);
    Message msg = new Message();
    msg.setSOAPTransport(m_httpConnection);
    msg.send(endpointURL, "http://www.webserviceX.NET/ConversionRate", requestEnv);
    Envelope responseEnv = msg.receiveEnvelope();
    Body responseBody = responseEnv.getBody();
    Vector responseData = responseBody.getBodyEntries();
    return (Double)fromElement((Element)responseData.elementAt(0), java.lang.Double.class);
    }

  • How to read a Value from Excel Cell into Oracle Forms 10g with Java

    Did any one Implamented a Java PJC to integrate Excel on Oracle Forms 10g?
    I Open Excel Applikation.
    Open a File like c:\import_test.xls
    read a number 05 from A:1 (i get it as return value).
    Save a number in a variable in Forms 10g
    Can any one help my please?
    Thanks

    why don't you use webutil.
    it has package client_ole2 which allows you to have programmatic interface with excel application.
    this is especially useful if the excel to be read is available in the client.

  • How to connect oracle forms 10g with oracle 10g express database?

    Hi all,
    I have downloaded and installed oracle forms 10g and oracle database 10g express, when I open net configuration assistant to test local net service, I tested the default service (EXTPROC_CONNECTION_DATA) BUT THE RESULT IS "ora-28547 connection to server failed probable oracle net admin error"
    How can I solve this issue?
    My tnsname.ora is located in c:\DevSuiteHome\network\admin\tnsnames.ora, and its contents is:
    # tnsnames.ora Network Configuration File: c:\DevSuiteHome\network\admin\tnsnames.ora
    # Generated by Oracle configuration tools.
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = nour-pc)(PORT = 1521))
    (CONNECT_DATA =
    (SERVICE_NAME = PLSExtProc)
    Edited by: user10228498 on Jan 21, 2011 11:37 PM

    I copied the contents of C:\oraclexe\app\oracle\product\10.2.0\server\NETWORK\ADMIN\tnsnames.ora and appended it to C:\DevSuiteHome\NETWORK\ADMIN\tnsnames.ora
    and tried net configuration management to test local net service, the test was ok, thus the first problem resolved.
    but the login problem in forms developer still exist and it claims that: ora-12154 tns could not resolve the connect identifier specified.
    any ideas?

  • Connect Oracle Forms 6i with Sql server

    Plz tell how to connect oracle Developer 6i with Microsoft Sql Server 2005.
    thanks

    Ghulam Yassen wrote:
    Plz tell how to connect oracle Developer 6i with Microsoft Sql Server 2005.
    thanksOracle Forms is best used against an Oracle database... so why on Earth would you want to use it against SQL Server?
    Aside from that, Oracle Forms is old technology... you'd be better using Oracle Application Express (Apex) for producing web based apps.
    If you must do things against an SQL Server database, you would need to set up heterogenous services connectivity (HS) and treat the SQL Server database as an external database.
    http://docs.oracle.com/cd/E11882_01/server.112/e25494/ds_concepts001.htm#ADMIN12079

  • Is it possible to use Oracle Forms 10g with Oracle 10g Lite Database?

    Hi All,
    We are in process of migrating our forms from 6i to 10g environment.
    We have two kinds of applications, one set run on general Oracle 11g database and the other set of forms run at the client machine using Oracle lite database.
    We dont have any problem with Forms 6i to connect to Lite database as it allows to connect through ODBC:DSN names. When we try to connect to a lite database (10gR3) from Forms 10g through ODBC/DSN, it's not allowing and throwing the below error.
    ORA-03121 : no interface driver connected - function not performed
    Can someone tell me if there is something wrong in our approach? Also advise how to use Oracle Lite database with Forms 10G.
    Sincerely,
    Praveen Manthena

    Hi,
    I have experience with 6i with lite database 10g. There are two version of lite database one is multi language support and other one in english. There lang problem in connectivity with multi language 10g lite database. I done connectivity with single language connectivity of 6i with 10g lite database. You should try this one with forms 10g.
    Regards,
    Naveed Ali

  • Oracle forms authentication with active directory without OID

    Hi Gurus,
    I need to implement active directory authentication in oracle forms.
    My scenario is this:
    1. The user is created in active directory
    2. The user is imported in our aplication, and then I assign the roles in Oracle, and create the user in my aplicattion.
    When the user logs, the system have to validate the password with MS-AD. If the password is right, then, the system start a session in Oracle.
    My questions are:
    1. How can I validate the password in AD ? Is it in clear text, unix crypt, AES ?
    2. In case the user has changed the password in AD, how can obtain he logs in oracle with the new password ?
    We use oracle enterprise edition, but we don't have oracle applications, so i can't use identity management.
    Thanks in advance for your help

    You will need Oracle SSO and OID to implement Active Directory authentication for Oracle Forms. It comes with Oracle Application Server. You will need to read up on how to use AD instead of OID as the user store for Oracle Single Sign-on (SSO). Forms will use SSO to login not really knowing which user store is used so there is no config needed on the Forms side (except enabling SSO).

  • How Connect Oracle Forms 6 With Database 11g R2

    Hello every one:
    I'm Have application made by Forms 6 and Oracle 10g, now i'm make upgrade to my DB to 11G
    but have problem when make connection between Forms 6 and 11g
    ORA-02248: invalid option for ALTER SESSION
    pls help me !!
    Thnx

    Oracle Forms 6i is not certified with Oracle RDBMS 11g and the last I read - there was no plans to certify Forms 6i with RDBMS 11g. If you search the Forums you can find some workarounds to make Forms 6i work with RDBMS 11g, but these are not Oracle Supported workarounds.
    Your only real options are to leave things as they are or upgrade both your Forms application and the database. If you opt to upgrade your Forms application, you need to upgrade your Forms application to at least Forms 10g R2 (10.1.2.0.2) to be supported.
    Craig...
    Edited by: CraigB on Jul 12, 2010 4:06 PM

  • Integrating Oracle Forms 11g with JavaScript - keystrokes support issues

    This article
    http://www.oracle.com/webfolder/technetwork/tutorials/obe/forms/11g/jsinteg/formsjsinteg/setup.htm
    shows the JavasriptIntegration with Oracle Forms.
    I am trying to navigate out of Oracle Forms Java Applet with separateFrame=false to access an external menu using JavaScript. I can't find a way to navigate out of Oracle Forms. My focus stays inside the currently opened form and the applet does not lose the focus.
    I need to access any external UI component by shifting the focus form the Java Applet to that components using only key strokes.
    Thanks for your help

    Vikas,
    Sorry for the delay. I am still investigating this. In general, it would appear as I mentioned. If the form that contains the code specific to the event monitoring has not been run, then it cannot be executed. We are trying to get clarification on the definition of "scope" in this case. In the mean time, one alternative might be to subclass the related triggers/pu and include them in all of the forms where you want them to fire. Currently I am suspecting that scope refers to a relationship to forms currently running. For example if you have form A, B, and C running a scope of "form" might suggest that the events are only monitored if the current form includes the necessary code. However, if "application" then even if the form containing the necessary code is not the current form, the necessary code would fire anyway. Again, I am trying to get more clarification, but it is slow coming.
    If this is truely an urgent issue, I encourage you to create a Service Request with Oracle Support.

  • How to install Oracle form 6i with Oracle8.1.7 on the same driver?

    My machine is P4 with W2K.
    How to install Oracle form6i with Oracle8.1.7 on this machine?
    Could some one give me the details?
    Thanks a lot!!

    Hi Shay,
    Thanks for help. I got it.
    The problem I met is I should not export/import Oralce folder in registry.
    If do that, Oracle only configure one home to either oracle817 or form6i.
    Thanks again

  • Oracle Forms run with Sun Java Plugin

    Hello,
    I have a machine which does not have Mozilla. But i wanna run the forms in Google Chrome, not IE. I installed JInitiator (the final version), but when i run the form i still got in Chrome that there are missing plugins.
    I should mention that i just installed Dev Suite 10gR2 and i did not change anything in forms configuration files.
    What should i change and where?
    Thanks

    Hi,
    from
    [http://fdegrelle.over-blog.com/article-4135746.html|http://fdegrelle.over-blog.com/article-4135746.html]
    - Prepare your /forms/server/formsweb.cfg file
    instead of the archive_jini tag, use the archive tag
    archive=frmall.jar,...,my_jar.jar
    add a special section (including the Webutil configuration)
    [javaplugin]
    baseHTMLJInitiator=webutiljpi.htm
    jpi_download_page=http://java.sun.com/products/archive/j2se/1.4.2_09/index.html
    jpi_classid=clsid:8AD9C840-044E-11D1-B3E9-00805F499D93
    jpi_codebase=http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#Version=1,4,0,0
    WebUtilArchive=frmwebutil.jar,jacob.jar
    WebUtilLogging=off
    WebUtilLoggingDetail=normal
    WebUtilErrorMode=Alert
    WebUtilDispatchMonitorInterval=5
    WebUtilTrustInternal=true
    WebUtilMaxTransferSize=16384
    If you don't use the Webutil library, point to the basejpi.htm start page:
    baseHTMLJInitiator=basejpi.htm
    - Configure the Forms Builder to use this section:
    Menu : Edit -> preferences...
    tab : runtime
    item : Application server url : http://my-machine:8890/forms/frmservlet?config=javaplugin
    Then run your forms !
    regards

  • OracleAS Form Service with Portal Server

    Hello,
    I already have my Oracle 10g Forms running in my AS using the Forms Service. I am planning to merge all my web-based forms applications into the Portal. Would I be still able to use my Forms Services within the Portal?
    Ganesh

    Hello,
    I already have my Oracle 10g Forms running in my AS using the Forms Service. I am planning to merge all my web-based forms applications into the Portal. Would I be still able to use my Forms Services within the Portal?
    Ganesh

  • Attach Forms With Comm Port in Oracle Forms

    I am trying to make connection of Oracle forms Builder with my device using comm port but i dnt know the complete procedure to attach the comm with oracle forms also i have no idea to convert asquii data to normal form.Please any one help me to attach comm port with my oracle forms and also convert asqui code which is showing on hyper terminal into normal data.Also I am using oracle forms 6i

    Make a java component (PJC) and use a rxtx library (http://rxtx.qbang.org/wiki/index.php/Examples) ...
    I have made a PJC to use a RS232 port from oracle forms for Hypercom POS terminal..
    Here is my code (in short i will post a component on PJC site (here I can't post a complete code because of 30000 char limit ;) )..
    If you look in method "public void init(IHandler handler) " I make a download of rxtxSerial.dll from my forms server and then I call System.loadLibrary("rxtxSerial");"
    In other way you must put the dll in windows/system32 path.. This dll is native library for rs232 communication.
    If you look at the method "public void doTransaction" you can see the initialization of comm port...
    With inputStream and OutputStream you read and write datas to/from your rs232 port..
    p.s: the code is not complete but you can see how I made the rs232 communication (also the code is not final ;) )
    ====================================================
    public class PosTerminalPjc extends VBean {
         private static final long serialVersionUID = -8814623494538014849L;
         Properties res = new Properties();
         SerialPort serialPort;
         OutputStream os;
         InputStream is;
         CommPortIdentifier portId;
         Enumeration portList;
         IHandler mHandler;
      Random randomGenerator = new Random();
            char STX = 2;
         char ETX = 3;
         char EOT = 4;
         char ACK = 6;
         char NAK = 15;
         char FS = 28;
         private static final ID COMPORT         = ID.registerProperty("COMPORT"); // serial port (COM1,COM2,COM3,...)
         private static final ID AMOUNT          = ID.registerProperty("AMOUNT"); // amount of the transaction (12)
         private static final ID TRANSACTIONTYPE = ID.registerProperty("TRANSACTIONTYPE"); // SALE, REFUND
      private static final ID EXECUTE         = ID.registerProperty("EXECUTE"); // invoke doTransaction();
      //Output parameters to form
      private static final ID TRANSACTIONPROCESSED  = ID.registerProperty("TRANSACTIONPROCESSED");
      private static final ID TRANSACTIONFLAG       = ID.registerProperty("TRANSACTIONFLAG");
      private static final ID TRANSACTIONNUMBER     = ID.registerProperty("TRANSACTIONNUMBER");
      private static final ID BATCHNUMBER           = ID.registerProperty("BATCHNUMBER");
      private static final ID TRANSACTIONDATE       = ID.registerProperty("TRANSACTIONDATE");
      private static final ID TRANSACTIONTIME       = ID.registerProperty("TRANSACTIONTIME");
      private static final ID TRANSACTIONAMOUNT     = ID.registerProperty("TRANSACTIONAMOUNT");
      private static final ID CARDDATASOURCE        = ID.registerProperty("CARDDATASOURCE");
      private static final ID NUMBERCUSTOMERCARD    = ID.registerProperty("NUMBERCUSTOMERCARD");
      private static final ID EXPIRATIONDATE        = ID.registerProperty("EXPIRATIONDATE");
      private static final ID TERMINALID            = ID.registerProperty("TERMINALID");
      private static final ID MERCHANTID            = ID.registerProperty("MERCHANTID");
      private static final ID COMPANYNAME           = ID.registerProperty("COMPANYNAME");
      private static final ID SEQUENTIALNUMBER      = ID.registerProperty("SEQUENTIALNUMBER");
      private static final ID ERRORDESC             = ID.registerProperty("ERRORDESC");
         //Events
      private static final ID EVT_OK  = ID.registerProperty("EVT_OK"); //custom event if all ok
      private static final ID EVT_ERR = ID.registerProperty("EVT_ERR"); //custom event if error occured
      // state machine variables
         long l_timeout;
         long l_wait_for = 5000; // pos terminal wait for command (5 seconds)
         long l_wait_for_transaction = 62000 * 2; // pos terminal timeout
         long l_second = 1000; // one second
         byte b_retry = 0;
         String dataValue = "";
      byte[] readBuffer = new byte[2000]; //2000 bytes buffer to read rs232 stream
         String comPort = ""; // local variable to store com port name
                                       // (COM1,COM2,...)
         String transactionType = "SALE"; // type of transaction to be executed (SALE
                                                      // or REFUND) default SALE
         String amount = "0"; // default amount value is set to 0
         //output paramerers
      String transactionProcessed = "";
      String transactionFlag = "";
      String transactionNumber = "";
      String batchNumber = "";
      String transactionDate = "";
      String transactionTime = "";
      String transactionAmount = "";
      String cardDataSource = "";
      String numberCustomerCard = "";
      String expirationDate = "";
      String terminalId = "";
      String merchandId = "";
      String companyName = "";
      String sequentialNumber ="";
      String errorDescription;
        public PosTerminalPjc() {
              super();
              System.out.println("============================");
              System.out.println("== State machine POS v1.0 ==");
              System.out.println("== Peter Valencic (c)     ==");
              System.out.println("== 03.04.2012             ==");
              System.out.println("============================");
        System.out.println("java.library.path: "+System.getProperty("java.library.path"));
              try {
                   res.load(this.getClass().getResourceAsStream("/res/language.properties")); // load language file
              } catch (Exception ex) {
                   System.err.println("Err loading language.properties file: "
                             + ex.toString());
      public void init(IHandler handler)
        super.init(handler);
        this.mHandler = handler;
        System.out.println("init handler ok");
        System.out.println("code base: "+handler.getCodeBase());
        //load dll from codeBase URL
        try
          String mylibName = "rxtxSerial.dll";
          String URLpath = "http://dekani:7777/forms/java/";
          System.out.println("URL: "+ URLpath + mylibName);
          URL libUrl = new URL(URLpath+mylibName);
          System.out.println("libUrlgetFile: " + libUrl.getFile());
          File file = new File(mylibName);
          System.out.println(file);
          if (!file.exists())
          file.createNewFile();
          URLConnection urlc = libUrl.openConnection();
          InputStream in = urlc.getInputStream();
          FileOutputStream out = new FileOutputStream(file);
          byte[] buffer = new byte[1048];
          int read;
          while ((read = in.read(buffer)) != -1){
             out.write(buffer, 0, read); // write
            out.close();
            in.close();
            System.loadLibrary("rxtxSerial");
        catch(Exception exc)
          System.err.println("Exception SystemLoadLibrary: " + exc.toString());
          this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_lib"));
      private void doTransaction() throws Exception {
        String sequentialNumber = ""+getRandomInteger(1000,9000,randomGenerator);
              String phase = null; // initial null value for state machine phase
              long l_ack_timeout = 0; //initial value for acknowledge timeout
              // com port check
              if (getComPort().trim().equalsIgnoreCase("")) {
                   this.showError(res.getProperty("s_dlg_err_title"),
                             res.getProperty("s_com_invalid"));
              if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_com_invalid"));
                                dispatchCustomEvent(ce);
                   return;
              // transaction type chek
              System.out.println(this.getTransactionType());
              if (!getTransactionType().equalsIgnoreCase("REFUND")
                        & !getTransactionType().equalsIgnoreCase("SALE")
            & !getTransactionType().equalsIgnoreCase("TICKET")
            & !getTransactionType().equalsIgnoreCase("VOID")
                   this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_tran_invalid_type"));
          if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_tran_invalid_type"));
                                dispatchCustomEvent(ce);
                   return;
              portList = portId.getPortIdentifiers();
              while (portList.hasMoreElements()) {
                   portId = (CommPortIdentifier) portList.nextElement();
          System.out.println(portId.getName());
                   if (portId.getName().equalsIgnoreCase(this.getComPort())) {
                        System.out.println("Port is used : "
                                  + portId.isCurrentlyOwned());
                        serialPort = (SerialPort) portId.open("ComDriver", 2000);
                        serialPort.setSerialPortParams(9600, SerialPort.DATABITS_7,
                                  SerialPort.STOPBITS_1, SerialPort.PARITY_EVEN);
                        serialPort.notifyOnDataAvailable(true);
                        serialPort.notifyOnOutputEmpty(true);
                        os = serialPort.getOutputStream();
                        is = serialPort.getInputStream();
                        break;
              if (portId == null) {
              this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_com_not_found"));
          if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_com_not_found"));
                                dispatchCustomEvent(ce);
                   return;
        else if (portId.getName().equalsIgnoreCase(this.getComPort()) == false)
                  this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_com_not_found"));
          if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_com_not_found"));
                                dispatchCustomEvent(ce);
          return;
              // state machine infinite loop
              while (true)
                   // SEND DATA TO POS TERMINAL
                   if (phase == null)
                        System.out.println("start phase");
                        byte[] req = null;
                        //verify transaction type to be SALE or REFUND
                        //if REFUND then transaction number must be specified
                        if (getTransactionType().equalsIgnoreCase("SALE")) {
                             System.out.println("--> SALE send message to the pos terminal");
                             System.out.println("--> amount: " + amount);
                             req = protocolStream("000000"+sequentialNumber+"01100" + FS + amount + FS
                                       + FS + "+0" + FS + "978" + FS + FS + FS + FS + FS
                                       + FS + FS + ETX);
                        else if (getTransactionType().equalsIgnoreCase("REFUND")) {
                             System.out.println("--> REFUND send message to the pos terminal");
                             System.out.println("--> amount: " + amount);
                             System.out.println("--> transaction number: " + getTransactionNumber());
                             req = protocolStream("000000123405100" + getTransactionNumber() + FS + amount
                                       + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                       + FS + FS + FS + ETX);
            else if (getTransactionType().equalsIgnoreCase("VOID")) {
                             System.out.println("--> VOID transaction");
                             System.out.println("--> amount: " + amount);
                             System.out.println("--> transaction number: " + getTransactionNumber());
                             req = protocolStream("000000123410100" + getTransactionNumber() + FS      + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                       + FS + FS + FS + ETX);
            else if (getTransactionType().equalsIgnoreCase("TICKET")) {
                             System.out.println("--> TICKET duplicate");
                               req = protocolStream("000000123413100" + getTransactionNumber() + FS      + FS + FS + "+0" + FS + "978" + FS + FS + FS + FS
                                       + FS + FS + FS + ETX);
            else {
                             //nothing ;)
                        os.write(req);
                        os.flush();
                        l_ack_timeout = System.currentTimeMillis() + 1500;
                        //wait for half second
                        Thread.sleep(500);
                        l_timeout = System.currentTimeMillis() + l_wait_for; //add some time for timeout
                        phase = "TO_POS_ACK";
                        System.out.println("phase: " + phase);
                   }//phase null
                   //CHECK IF THE TIMEOUT OCCURED
                if (phase.equalsIgnoreCase("TO_POS_ACK") & (l_timeout < System.currentTimeMillis()) & (b_retry < 4))
                    b_retry += 1;
                    System.out.println("TIMEOUT: " + b_retry);
                    l_timeout = System.currentTimeMillis() + l_wait_for;
                    if (b_retry >= 4) {
                        System.out.println("Timeout occured");
                        closePort();
                        this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_timeout"));
                        break;
              //CHECK FOR THE ACKNOWLEDGE (FIRST RESPONSE FROM POS TERMINAL)
                if (phase.equalsIgnoreCase("TO_POS_ACK") &
                        (l_ack_timeout < System.currentTimeMillis())) {
                    try {
                        int numBytes = 0;
                        dataValue = "";
                        while ((numBytes = is.read(readBuffer)) > 0) {
                            dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                        if (dataValue.getBytes().length > 0) {
                            System.out.println("->first byte: " +
                                dataValue.getBytes()[0]);
                            System.out.println("total length: " +
                                dataValue.getBytes().length);
                            //check for ack byte
                            if (dataValue.getBytes()[0] == 6) {
                                System.out.println(
                                    "<--ACKNOWLEDGE received from pos terminal");
                                phase = "WAIT_FOR_TRANSACTION";
                                l_timeout = System.currentTimeMillis() + l_wait_for_transaction;
                                System.out.println("-> wait for transaction response");
                    } catch (IOException ev) {
              //WAIT FOR TIMEOUT ON MESSAGE (watch dog timer)
                if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION") &
                        (l_timeout < System.currentTimeMillis())) {
                    System.out.println(
                        "Error receiving response from pos terminal!!!");
                    closePort();
                    this.showError(res.getProperty("s_dlg_err_title"),
                                 res.getProperty("s_response_error"));
                  if (this.mHandler != null)
                    CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                    this.setErrorDescription(res.getProperty("s_response_error"));
                    dispatchCustomEvent(ce);
                    break;
              //WAIT FOR SOME DATA TO COME FROM POS TERMINAL OVER RS232
                if (phase.equalsIgnoreCase("WAIT_FOR_TRANSACTION")) {
                    try {
                        int numBytes = 0;
                        dataValue = "";
                        Thread.sleep(500);
                        while ((numBytes = is.read(readBuffer)) > 0) {
                            dataValue += new String(readBuffer, 0, numBytes, "ASCII");
                        if (dataValue.getBytes().length > 0) {
                            System.out.println("->first byte: " +
                                dataValue.getBytes()[0] + "|" +
                                dataValue.getBytes()[1]);
                            System.out.println("->ascii: " + dataValue);
                            System.out.println("total length: " +
                                dataValue.getBytes().length);
                            if (dataValue.indexOf("PREKINIL UPORABNIK") != -1) {
                                System.out.println(
                                    "Uporabnik je prekinil povezavo!");
                                  closePort();
                                //transaction cancelled by user s_user_cancel
                                this.showError(res.getProperty("s_dlg_err_title"),
                                             res.getProperty("s_user_cancel"));
                              if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_user_cancel"));
                                dispatchCustomEvent(ce);
                                break;
                            if (dataValue.indexOf("NAPACEN VNOS") != -1) {
                                System.out.println("Napačen vnos");
                                closePort();
                                //invalid user entry
                                this.showError(res.getProperty("s_dlg_err_title"),
                                             res.getProperty("s_user_invalid_entry"));
                               if (this.mHandler != null)
                                CustomEvent ce = new CustomEvent(this.mHandler, EVT_ERR);
                                this.setErrorDescription(res.getProperty("s_user_invalid_entry"));
                                dispatchCustomEvent(ce);
                                break;
                            if (dataValue.indexOf("PROSIM POCAKAJ") != -1) {
                                System.out.println("<-- PROSIM POCAKAJ");
                                continue;
                            //preberemo podatke iz stringe terminala
                            if (dataValue.indexOf("SPREJETO") != -1) {
                                closePort();
                                System.out.println("<-- TRANSAKCIJA SPREJETA");
                                System.out.println(dataValue);
                                StringTokenizer st = new StringTokenizer(dataValue, "\034" );
                                String dv = st.nextToken();
                                sequentialNumber = dv.substring(6,10);
                                transactionProcessed = dv.substring(1, 3);
                                transactionFlag = dv.substring(13,15);
                                transactionNumber = dv.substring(15,21);
                                batchNumber = dv.substring(21,25);
                                transactionDate = dv.substring(25,31);
                                transactionTime = dv.substring(31,37);
                                transactionAmount = st.nextToken();
                                st.nextToken(); //Amount exponent
                                st.nextToken(); //Amount currency
                                cardDataSource = st.nextToken();
                                numberCustomerCard = st.nextToken();
                                expirationDate = st.nextToken();
                                st.nextToken(); // authorization code
                                terminalId = st.nextToken();
                                merchandId = st.nextToken();
                                companyName = st.nextToken();
                                System.out.println("================");
                                System.out.println(transactionProcessed);
                                System.out.println(transactionFlag);
                                System.out.println(transactionNumber);
                                System.out.println(batchNumber);
                                System.out.println(transactionDate);
                                System.out.println(transactionTime);
                                System.out.println(transactionAmount);
                                System.out.println(cardDataSource);
                                System.out.println(numberCustomerCard);
                                System.out.println(expirationDate);
                                System.out.println(terminalId);
                                System.out.println(merchandId);
                                System.out.println(companyName);
                                if (this.mHandler != null)
                                  System.out.println("dispatch custom event");
                                  CustomEvent ce = new CustomEvent(this.mHandler, EVT_OK);
                                  dispatchCustomEvent(ce);
                                return;
                    } catch (IOException ev) {
                      System.err.println("Exception sm: " + ev.toString());
                System.out.print('*');
                Thread.sleep(200);
              }//end state machine loop
          * protocolStream prepare the stream to be send over RS232 to POS terminal
          * with LRC cheksum control
          * @param data
          * @return byte[]
         private byte[] protocolStream(String data) {
              char STX = (char) 0x02;
              String tmp = "" + STX + STX + data + "" + getLRC(data);
              System.out.println("PStream: " + tmp);
              for (int i = 0; i < tmp.getBytes().length; i++) {
                   System.out.print(tmp.getBytes() + ":");
              return tmp.getBytes();
    * close port and stream
    private void closePort()
    try {
    serialPort.close();
    is.close();
    os.close();
    } catch (Exception ee) {
         * Longitudinal Redundancy Check (LRC)
         * @param packet
         * @return String
         private String getLRC(String packet) {
              char[] splitPacket = packet.toCharArray();
              char lrc = 0x00;
              for (int x = 0; x < splitPacket.length; x++) {
                   lrc = (char) (lrc ^ splitPacket[x]);
              return "" + (char) lrc;
         private String paddingString(String s, int n, char c, boolean paddingLeft) {
              if (s == null) {
                   return s;
              int add = n - s.length(); // may overflow int size... should not be a
              if (add <= 0) {
                   return s;
              StringBuffer str = new StringBuffer(s);
              char[] ch = new char[add];
              Arrays.fill(ch, c);
              if (paddingLeft) {
                   str.insert(0, ch);
              } else {
                   str.append(ch);
              return str.toString();
    public boolean setProperty(ID id, Object value)
    if (id.toString().equalsIgnoreCase("COMPORT")) {
    setComPort((String)value);
    System.out.println("RS232 com port: " + getComPort());
    return false;
    if (id.toString().equalsIgnoreCase("AMOUNT")) {
    this.setAmount((String)value);
    System.out.println("Amount value: " + getAmount());
    return false;
    if (id.toString().equalsIgnoreCase("TRANSACTIONTYPE")) {
    this.setTransactionType((String)value);
    System.out.println("Transaction Type value: " + this.getTransactionType());
    return false;
    if (id.toString().equalsIgnoreCase("EXECUTE")) {
    System.out.println("Invoke pos terminal");
    try
    doTransaction();
    catch(Exception ex)
    System.err.println("Execute Exception>> " + ex.toString());
    this.showError(res.getProperty("s_dlg_err_title"),res.getProperty("s_gen_exception"));
    return false;
    return false;
         * Display error message inside oracle form
         * @param title
         * @param exceptionString
         private void showError(String title, String exceptionString) {
              JOptionPane.showMessageDialog(this, exceptionString, title, 0);
    Edited by: peterv6i.blogspot.com on May 8, 2012 10:18 AM
    Edited by: peterv6i.blogspot.com on May 8, 2012 10:20 AM
    Edited by: peterv6i.blogspot.com on May 8, 2012 10:21 AM

Maybe you are looking for

  • Apple's iPhone Recycle Program

    If I take advantage of Apple's recycle program and exchange my iPhone 4 for an Apple Store gift card, can I then use that card towards a new iPhone in the same transaction (covering any additional cost of course)?

  • Regarding the 'TOTALS' in ALV's

    Hi friends, I have a doubt in ALV while displaying totals. How can we display the "totals" immediately when the ALV output is displayed. I tried many ways but when im clicking on the 'Summation' symbol in the output of the ALV then only the 'Totals'

  • Oracle Support on XML

    How is XML supported in Oracle8i and Oracle Application Server and on any other Oracle development tools. Could you give a demo on those features that support XML. null

  • Purchased amazon, adobe premier elements 13 & photoshop elements 13 but there is no redemption code

    There was no code on the box or on the disc

  • Trying to send a different field for PU12

    Hi everyone, As of now, the position text that PU12 is sending for the OR segment (P0001) is of length 25 (PLSTX from table T528T). However, I have a requirement where I need to send the position text as length 40 (as can be seen on the OM side-table