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:
-----------------------------------------------------------