users@saaj.java.net

Re: [SAAJ-USR] getSOAPBody problem

From: suresh_at_Sun <Suresh.Mandalapu_at_Sun.COM>
Date: Wed, 10 Dec 2008 17:48:09 +0530

Hi RICO
i tried it by taking your input and it is working when we keep
soapmessage as a continuous text(without leaving spaces in between child
elements) as given below.
<?xml version="1.0"
encoding="utf-8"?><soapenv:Envelopexmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body><get_SAserviceDetail><input_1><concept
name="ItalianWine" multiplicity="1"/></input_1>
<output_1><conceptname="Winery"multiplicity="1"/></output_1></get_SAserviceDetail></soapenv:Body></soapenv:Envelope>
.....
so please try it by leaving no spaces in the message.
suresh

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