XML & Web services: WebService problem : SOAP,Saaj
I am developong a WebService Client ..The webservice we are accessing requires that we use SOAP 1.2 for all communications. Can you please help me with the following query? For the purpose to satisfy the requirements, I am using the SAAJ 1.3 APIs. I have imported saaj-api.jar and saaj-impl.jar. I am using WSAD 5.1.0 as the IDE. I am unable to create a SOAP message. The same works when I use the default SAAJ APIs available with WSAD. //Create Message MessageFactory requestMessageFactory = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL); SOAPMessage requestMessage = requestMessageFactory.createMessage(); //Get the SOAPBody SOAPEnvelope requestEnvelope = requestMessage.getSOAPPart().getEnvelope(); requestBody = requestEnvelope.getBody().addBodyElement(requestEnvelope.createName("Request"); //Add Body element to SOAP Body SOAPElement hdrTag = requestBody.addChildElement(requestEnvelope.createName("Hdr")); SOAPElement reqBdyTag = requestBody.addChildElement(requestEnvelope.createName("ReqBdy")); System.out.println(requestBody.toString()); The above line returns the value as [Request: null] 1. Can you please let me know where I am may be going wrong? 2. Is this a problem due to compatibility issue? 3. If SAAJ 1.3 is not preferable for implementation of SOAP 1.2 in WSAD, what other ways I can generate/handle SOAP request/response? Please help me out.
- Posted by: Ramesh Potti
- Posted on: September 13 2006 15:23 EDT
SAAJ 1.3 EA (with support for SOAP 1.2) is included in the open-source Java E 5-compliant application server http://java.sun.com/webservices/saaj/index.jsp Hope you have right version of SAAJ - 1.3 EA. One way to check is to use : MessageFactory factory = MessageFactory.newInstance(SOAPConstants.DYNAMIC_SOAP_PROTOCOL ); to check if it works for dynamic soap protocol... Bhagvan K http://www.jroller.com/page/bhagvank