0 Replies Latest reply: May 14, 2011 2:25 AM by Gauravv RSS

    Intermittent Connection while connecting to https securePay in iStore

    Gauravv
      Hi,

      We are facing a strange issue in iStore in DMZ

      We are using the following coding in a jsp to connect to securePay website over https protocol and sending a xml message to get the response back.

      try{
                String PaymentUrl = "https://api.securepay.com.au/xmlapi/payment";
                          
                String SecurePayXml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"+
                "<SecurePayMessage>"+
                     "<MessageInfo>"+
                          "<messageID>8af793f9af34bea0cf40f5fb5c630c</messageID>"+
                          "<messageTimestamp>20041803161306527000+660</messageTimestamp>"+
                          "<timeoutValue>60</timeoutValue>"+
                          "<apiVersion>xml-4.2</apiVersion>"+
                     "</MessageInfo>"+
                     "<MerchantInfo>"+
                          "<merchantID>ABC0001</merchantID>"+
                          "<password>changeit</password>"+
                     "</MerchantInfo>"+
                     "<RequestType>Payment</RequestType>"+
                     "<Payment>"+
                          "<TxnList count='1'>"+
                               "<Txn ID='1'>"+
                                    "<txnType>0</txnType>"+
                                    "<txnSource>0</txnSource>"+
                                    "<amount>1000</amount>"+
                                    "<purchaseOrderNo>test</purchaseOrderNo>"+                    
                                    "<CreditCardInfo>"+
                                         "<cardNumber>4444333322221111</cardNumber>"+                         
                                         "<expiryDate>09/15</expiryDate>"+                    
                                    "</CreditCardInfo>"+               
                               "</Txn>"+          
                               "</TxnList>"+     
                          "</Payment>"+
                "</SecurePayMessage>";
                
                     
                
                System.setProperty("proxySet", "true");
      System.out.println(" Setting Proxy ");     
           System.setProperty("http.auth.ntlm.domain", "toshiba-tap.com");
           
           //For SSL - HTTPS
           System.setProperty("https.proxyHost", "psyche.toshiba-tap.com");
           System.setProperty("https.proxyPort", "8080");
           System.setProperty("java.protocol.handler.pkgs", "com.sun.net.ssl.internal.www.protocol");
           Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()) ;
      System.out.println(" Setting Proxy Ports");     
                
                System.getProperties().remove("http.proxyHost");
           System.getProperties().remove("http.proxyPort");

      System.out.println("Removed HTTP Proxy Port settings");
                
                URL url = new URL(PaymentUrl);
           URLConnection conn = url.openConnection();
           System.out.println(" Getting Connection "+conn);     

           
      conn.setUseCaches(false);
           conn.setDoOutput(true);
           System.out.println("printing before sending==========================");
           System.out.println(SecurePayXml.toString());

           OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
      System.out.println("getting outputStream");
           wr.write(SecurePayXml);
           wr.flush();
           wr.close();

           
      System.out.println("Getting Response");
           // Get the response
           BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
           String line;
      System.out.println("Got Response");
           

           while ((line = rd.readLine()) != null) {
                System.out.println("x10asecurePaySync.jsp Line " + line);
           sb.append(line);
           }
           rd.close();
           
           System.out.println("RESPONSE ==========================");
           
           System.out.println(sb.toString());
                out.println(sb.toString());     
           
           }
      catch(Exception e)
           {
                e.printStackTrace();
           }


      The same coding if we execute through command prompt we are able to get response but when used in iStore in DMZ
      then we get the response intermittently after boncing apache a number of times.


      Please let us know any pointers on it as it has become a major show stopper for the application to Go Live.

      Any help will be highly appreciated.

      Thanks,
      Gaurav