How to get specific tag from an xml in soap response
I 开发者_如何学JAVAam an android developer and I use SOAP to get responses from the server in xml format. Below is the code I am using:
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
try
{
httpTransport.call(SOAP_ACTION, envelope);
Object response = envelope.getResponse();
textView.setText(response.toString());
}
catch (Exception exception)
{
textView.setText(exception.toString());
}
I am getting response in xml tag format but I need only photourl tag from the response, how to get that?
Parse the answer to get the needed datas or write a manualy soap request to get only what you want. Whit SAX for example
To send a manualy written request you can use this code which works. To write the soap request/enveloppe you can use soapUI software which do that, this looks like :
<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:plan=\"http://...\" xmlns:com=\"...\">
<soapenv:Header/>
<soapenv:Body>
<plan:..>
<com:..> ... </com:..>
</plan:..>
</soapenv:Body>
</soapenv:Envelope>
精彩评论