I am trying to consume a web service for 2 days now and I failed. Here is my code :
String SOAP_ACTION = "urn:WsTestIntf-IWsTest#Test101";
String METHOD_NAME = "Test101";
String NAMESPACE = "urn:WsTestIntf-IWsTest";
String URL = "http://wsig.127.cc:8465/WsTemp.dll/wsdl/IWsTest";
String strTemp;
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject resultsRequestSOAP = (SoapObject) envelope.bodyIn;
strTemp = resultsRequestSOAP.toString();
} catch (Exception e) {
strTemp = "Error : " + e.getMessage();
}
Toast.makeText(getBaseContext(), strTemp, Toast.LENGTH_SHORT).show();
What is wrong with it? I have place the INTERNET permission in my manifest. The web service is written in Delphi.
I had a rough time long back with ksoap2, but have a working client side code.. Hope it helps...
Note: It retries for 3 times, you can remove it if you want..