Using ksoap2 v2.5.8 library, I do so:
public static String conectWs(String URL, String NAMESPACE, String METHOD_NAME, String strDataXmt, String param) throws Exception{
HttpTransportSE androidHttpTransport = null;
SoapObject request = new SoapObject(NAMESPACE , METHOD_NAME);
request.addProperty(param, strDataXmt);
//androidHttpTransport.debug = true;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
envelope.dotNet = true;
androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(NAMESPACE + METHOD_NAME, envelope);
Object results = (Object) envelope.getResponse();
return results.toString();
}
Then, to read this result string as an Xml, I do this parse:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(new InputSource(new StringReader(stringDeResultado)));
doc.getDocumentElement().normalize();
NodeList nodeList = doc.getElementsByTagName("suaTag");
If possible, use a REST Service with Json, as each SOAP envelope is too large and can consume enough data traffic on Android.
– Reiksiel
the problem is that the webservice is created outside the company... so I have no say in =/
– AntonioQueiroz
I understand, anyway that would be a good argument.
– Reiksiel