This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
//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"));
The above line returns the value as [Request: null]
The same code when run using the default jars present in WSAD webservices.jar (conforming to SOAP 1.1), the following is returned: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><Request xmlns=""> <Hdr xmlns=""> hdr</Hdr><ReqBdy xmlns="">reqbdy</ReqBdy></soapenv:Body></soapenv:Envelope>
In the debug mode, when i check the value of the variable requestBody it shows all the fields properly populated.
1. Can you please let me know where I may be going wrong? 2. Is this a problem due to compatibility issue? 3. Is this a problem with the implementation jar of SAAJ 1.3? 3. Have I forgotten to include some importatn jars? 4. 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?