J'essaie d'appeler un service Web à partir du client Android à l'aide de la bibliothèque ksoap.Impossible d'appeler la méthode du service Web C# .net à partir du client Android
Voici mon code Android
private static final String SOAP_ACTION = "http://tempuri.org/HelloWorld";
private static final String METHOD_NAME = "HelloWorld";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://192.16.0.230/WebService/Test.asmx";
TextView tv;
public void call()
{
try {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("name", "zawoad");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet=true;
envelope.setOutputSoapObject(request);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);
String result = (String)envelope.getResponse();
tv.setText(result);
} catch (Exception e) {
tv.setText("exception :" + e.getLocalizedMessage());
}
}
Et voici ma méthode de service Web qui est écrit dans Test.asmx fichier
[WebMethod]
public string HelloWorld(string name)
{
return "Hello World" + name;
}
Lorsque la ligne androidHttpTransport.call(SOAP_ACTION, envelope);
est exécuté, il jette l'exception suivante
org.xmlpull.v1.XmlPullParserException: attendu: START_TAG {http://schemas.xmlsoap.org/so ap/enveloppe/enveloppe} (position: START_TAG @ 2: 44 [email protected])
S'il vous plaît aider ..