I'm starting to deal with SOAP messages and I need to get this response's string to then convert it into a picture but the problem is to get the string to begin with.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<ObtenerImagenResult>This is a picture</ObtenerImagenResult>
Well, the answer for this wasn't very complicated.
After we get the response of the SOAP request all we have to do is to extract the body as Document and then get the first child's value as a String.
SOAPBody sb = soapResponse.getSOAPBody(); Document XMLDoc = sb.extractContentAsDocument(); NodeList nl = XMLDoc.getElementsByTagName("ObtenerImagenResult"); String response = nl.item(0).getFirstChild().getNodeValue(); return response;
That's the best way to get that only item. I hope it's helpful for you.