Results 1 to 3 of 3
  1. #1
    Fortunato is offline Member
    Join Date
    Oct 2010
    Rep Power

    Exclamation Migrating Java SOAP app. Help please

    Hello :)
    I'm having a problem moving an existing application to a new server. On the new server, the app is returning nulls when reading any part of the SOAP response. This app uses the standard java SOAP lib, javax.xml.soap.

    All the non-standard jars have been copied/updated. As far as I can tell, the software differences between the old and new servers are OS, JVM version, and Tomcat version.

    New Server
    Tomcat Version : Apache Tomcat/6.0.26
    JVM Version : 1.6.0_20-b02
    JVM Vendor : Sun Microsystems Inc.
    OS Name : Windows Server 2008 R2
    OS Version : 6.1
    OS Architecture : amd64

    Old Server
    Tomcat Version : Apache Tomcat/5.5.9
    JVM Version : 1.5.0_11-b03
    JVM Vendor : Sun Microsystems Inc.
    OS Name : Windows 2003
    OS Version : 5.2
    OS Architecture : x86

    The SOAP response is recevied by both and looks the same. It is written to the logs on both servers.
    Java Code:
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd="">
          <CheckResponse xmlns="http://www.xxxxxx.zzz/">
    The java code itself, throws no error when accessing the SOAP response. It even writes the log with the full response text but when trying to read the response elements it only returns a null.

    Here's the section of code in question :

    Java Code:
    // Build XML and pass it all to JA's web service.  Trap any errors in strStatus...WG
    try {
        // Init.
        SOAPConnectionFactory SOAPConnFac = SOAPConnectionFactory.newInstance();
        SOAPFactory SOAPFac = SOAPFactory.newInstance();
        MessageFactory MessageFac = MessageFactory.newInstance();
        // Create the SOAP Connection.
        SOAPConnection SOAPConn = SOAPConnFac.createConnection();
        // Build the SOAP request message.
        SOAPMessage SOAPRequestMsg = MessageFac.createMessage();
        // Add info to the MIME header for .NET compatibility, (JA's service is written in .NET).
        MimeHeaders hd = SOAPRequestMsg.getMimeHeaders();
        hd.addHeader("SOAPAction", "http://www.companyserver.zzz/companySOAP");
        // Remove the SOAP message header, it is not needed in this case.
        SOAPHeader SOAPRequestHeader = SOAPRequestMsg.getSOAPHeader();
        // Build the SOAP body element companySOAP.
        SOAPBody SOAPRequestBody = SOAPRequestMsg.getSOAPBody();
        javax.xml.soap.Name nameRequestBody = SOAPFac.createName("companySOAP", "", "http://www.companyserver.zzz/");
        SOAPBodyElement sbeRequestBodyEle = SOAPRequestBody.addBodyElement(nameRequestBody);
        // Add all child elements to the companySOAP element.
        SOAPElement seNameNode = sbeRequestBodyEle.addChildElement("Name");
        seNameNode.addChildElement("MiddleInitial").addTextNode((strDBMName != null) ? ((strDBMName.length()>1) ? strDBMName.substring(0,1) : strDBMName) : "");
        SOAPElement seDOBNode = sbeRequestBodyEle.addChildElement("DOB");
        // Debug code, writes xml to the log file.
        URL urlWebService = new URL ("http://SOAPServer/companySOAP/");
        // Send the SOAP request message and get back the SOAP response message.
        SOAPMessage SOAPResponseMsg =, urlWebService);
        // Debug code, writes xml to the log file.
        // Pull out the SOAP response body.
        SOAPBody SOAPResponseBody = SOAPResponseMsg.getSOAPBody();
        // Check for SOAP faults.
        if (SOAPResponseBody.hasFault()) {
            intProgressMarker = 101; // Tracking information.
            SOAPFault newFault = SOAPResponseBody.getFault();
            strStatus = "SOAP FAULT:<br>";
            strStatus += "<br>code = " + newFault.getFaultCodeAsName();
            strStatus += "<br>message = " + newFault.getFaultString();
            strStatus += "<br>actor = " + newFault.getFaultActor()+"<br>";
            boolOK = false;
        } else {
            // Pull the CheckResponse element out of the SOAP response body.
            javax.xml.soap.Name nameResponseBody = SOAPFac.createName("CheckResponse", "", "http://www.companyserver.zzz/");
            Iterator iterElement = SOAPResponseBody.getChildElements(nameResponseBody);
            if (iterElement.hasNext()){
                SOAPBodyElement sbeResponseBodyEle = (SOAPBodyElement);
                // Check for success or failure.
                String strResultMsg = ((sbeResponseBodyEle.getValue() == null) ? sbeResponseBodyEle.toString() : sbeResponseBodyEle.getValue());
                strStatus = "<br>Check response came back from SOAPServer as * " + strResultMsg + " *<br>";
                // Note : using compareTo() will not work here due to invisible non-blank chars in strResultMsg.
                boolOK = (strResultMsg.trim().toUpperCase().indexOf("SUCCESS") > 0);
                intProgressMarker = (boolOK) ? 1 : 100; // Tracking information.
            } // End if (iterElement.hasNext())
        } // End if (SOAPResponseBody.hasFault())
    } catch(Exception e) {
        intProgressMarker = 102; // Tracking information.
        strStatus = "Error : "+((e.getMessage() != null) ? e.getMessage() : e.toString());
        boolOK = false;
        // Extra debug info.
        StackTraceElement[] aryStackTrace = e.getStackTrace();
        for (int intElement = 0; intElement < aryStackTrace.length; intElement++)
            strStatus += aryStackTrace[intElement].toString();
            strStatus += "<br>";
        if (strStatus.length() > 500) {
            strStatus = strStatus.substring(0, 499);
    } // End try
    The output generated by that code for the old server is :
    Check response came back from SOAPServer as * SUCCESS *

    On the new server it is :
    Check response came back from SOAPServer as * null *

    Any ideas/fixes for this issue?

    Thanks for the help folks.

  2. #2
    travishein's Avatar
    travishein is offline Senior Member
    Join Date
    Sep 2009
    Rep Power


    if these soap cllases come from the built-into java API, it's quite possible these have changed a lot from 1.5 to 1.6. Recently I had an issue with JaxRPC that was upgraded to a different version between an update release, like between 1.6.0_16 and 1.6.0_17.

    if possible try to run things on java 1.5 on the new machine to see if the errors go away ?

  3. #3
    Fortunato is offline Member
    Join Date
    Oct 2010
    Rep Power

    Default got it now

    I found what it was. In short, I was over confident about what was loading and what was not. That'll teach me.

    Long answer, axis 1.5 was on the old system but was not suppose to be used because it was not in the endorsed folder and hence should not have loaded at all thanks to changes in java (1.4 I think) that introduced jar endorsing. The combination of JVM 1.5 and Tomcat 5.5 did allow the load of the jaxrpc.jar from axis (which I was, wrongly, so sure would not be allowed). While the javax.xml.soap lib (saaj.jar) was not loaded, it looks like the change in rpc was enough to break things when the axis based jar was no longer loaded.

    The new server behaved as I expected it to in relation to endorsed jars while the old server did not.

    Well, lesson learned. Assume nothing! Ok, may you can assume a few things so you don't end up like Descartes - staring at wax in your hand and contemplating the existence or both wax and hand. Thanks and later all.

Similar Threads

  1. Replies: 1
    Last Post: 10-25-2010, 06:54 PM
  2. Java GForge SOAP Interface 0.0.8
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-13-2007, 05:33 PM
  3. Java GForge SOAP Interface 0.0.7
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 07-09-2007, 04:41 PM
  4. Java GForge SOAP Interface 0.0.4
    By JavaBean in forum Java Software
    Replies: 0
    Last Post: 06-26-2007, 09:50 PM
  5. Java GForge SOAP Interface 0.0.3
    By levent in forum Java Software
    Replies: 0
    Last Post: 06-19-2007, 05:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts