Friday, 26 December 2014

JAVA Soap response getContent OK but body empty



I'm new with soap :)


I make soap request to the server all is ok. Get the response in SOAPMessage like this :



SOAPMessage soapResponse = soapConnection.call(soap, url);


I print it with this :



TransformerFactory transformerFactory = TransformerFactory.newInstance();
Transformer transformer = transformerFactory.newTransformer();
Source sourceContent = soapResponse.getSOAPPart().getContent();
System.out.print("\nResponse SOAP Message = ");
StreamResult result = new StreamResult(System.out);
transformer.transform(sourceContent, result);


and I got this :



Response SOAP Message = <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://ift.tt/sVJIaE" xmlns:xsd="http://ift.tt/tphNwY" xmlns:xsi="http://ift.tt/ra1lAU"><SOAP-ENV:Body><xsd:PMT>NOK</xsd:PMT></SOAP-ENV:Body></SOAP-ENV:Envelope>


all is ok. The problem is when I want to get body with this :



soapResponse.getSOAPBody();


this return : [SOAP-ENV:Body: null]


I would like to get the body and manipulate (the xml) easily


Thanks


No comments:

Post a Comment