Hi Suresh, I tried your code and it works. Although my problem concerne the
building of a SOAPMessage from an InputStream coming from a jsp page.I know
that JDK 6 has an internal implementation of JAXP, someone knows how can I
force Eclipse to use SAAJ instead of JDK JAXP implementation?
Suresh, below the code that causes me this output:
*********
OUTPUT: [#text:
]
*********
public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException {
res.setContentType("text/xml; charset=utf-8");
SOAPMessage soapReq = null;
SOAPMessage soapRes = null;
try {
MessageFactory msgFactory = MessageFactory.newInstance();
soapReq = msgFactory.createMessage(null, req.getInputStream());
soapReq.saveChanges();
soapRes = msgFactory.createMessage();
System.out.println(soapReq.getSOAPBody().getFirstChild().toString());
soapReq.writeTo(res.getOutputStream());
} catch (SOAPException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
********* SOAP MESSAGE *********
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="
http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<get_SAserviceDetail>
<input_1>
<concept name="ItalianWine" multiplicity="1"/>
</input_1>
<output_1>
<concept name="Winery" multiplicity="1"/>
</output_1>
</get_SAserviceDetail>
</soapenv:Body>
</soapenv:Envelope>