[jboss-user] [JBoss Web Services] - Sporadic error sending SOAP messages

Sat Ena do-not-reply at jboss.com
Mon Feb 28 14:53:25 EST 2011


Sat Ena [http://community.jboss.org/people/sat.ena] created the discussion

"Sporadic error sending SOAP messages"

To view the discussion, visit: http://community.jboss.org/message/590160#590160

--------------------------------------------------------------
Hi,

I am facing a sporadic (intermittent) issue when tried to send SOAP messages over HTTPS through a proxy. Below are the checks done

- SSL certificates installed.
- WebService end-point is always avaliable. No issue with it.
- When the failed messages are re-sent they go through fine.
- Connected through a proxy server.
- Using SAAJ api provided by Jboss installation
     /server/default/lib/saaj-api.jar
     /server/default/lib/saaj-impl.jar
- Java version: jdk1.5.0_11
- Jboss version: jboss-4.0.5.GA

Code Snippet of client which sends the SOAP message:
-----------------------------------------------------------------------------------
private String sendSoap(String content) throws IOException 
    {
        String retValue = "";
        try {
            String methodName = this.properties.getProperty ("method");
            String url = this.properties.getProperty ("url");
            String soapAction = this.properties.getProperty ("action");
            if (soapAction==null) soapAction = "DEFAULT";
            String nameSpace = this.properties.getProperty (methodName+".namespace");
            String parameter = this.properties.getProperty (methodName+".parameter");

            javax.xml.soap.SOAPMessage message = javax.xml.soap.MessageFactory.newInstance().createMessage();
            message.getMimeHeaders().addHeader("SOAPAction",soapAction);
            javax.xml.soap.SOAPHeader header = message.getSOAPHeader();
            javax.xml.soap.SOAPBody body = message.getSOAPBody();
            javax.xml.soap.SOAPFactory soapFactory = javax.xml.soap.SOAPFactory.newInstance();
            javax.xml.soap.Name bodyName = soapFactory.createName(methodName,"ns0",nameSpace);
            javax.xml.soap.SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
            javax.xml.soap.Name parameterName = soapFactory.createName (parameter);
            javax.xml.soap.SOAPElement parameterElement = soapFactory.createElement (parameterName);
            parameterElement.addTextNode (content);
            bodyElement.addChildElement (parameterElement);
            java.io.ByteArrayOutputStream out1 = new java.io.ByteArrayOutputStream();
            message.writeTo (out1);
            java.net.URL endpoint = new java.net.URL(url);

            javax.xml.soap.SOAPConnection conn = javax.xml.soap.SOAPConnectionFactory.newInstance().createConnection();

            javax.xml.soap.SOAPMessage response = conn.call(message,endpoint);
            java.io.ByteArrayOutputStream out2 = new java.io.ByteArrayOutputStream();
            response.writeTo(out2);
            logger.debug("XML Response String ==> " + out2.toString());
            javax.xml.soap.SOAPBody responseBody = response.getSOAPBody();

            org.w3c.dom.Document document = responseBody.extractContentAsDocument();
            retValue = document.getElementsByTagNameNS( nameSpace, methodName+"Return").item (0).getTextContent ();

       } 
        catch (SOAPException ex) 
        {       ex.printStackTrace();
            throw new IOException(ex.getMessage());
        } 
        catch (FactoryConfigurationError ex) 
        {
            ex.printStackTrace();
            throw new IOException(ex.getMessage());
        }
        return retValue;
    }

Error stack trace when messaged failed:
-----------------------------------------------------------
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/590160#590160]

Start a new discussion in JBoss Web Services at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2044]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20110228/3a51be3f/attachment-0001.html 


More information about the jboss-user mailing list