I have an android app that must connect to my local webservice with soap but I cant seem to get it working. This is the code I have.
[HIGH]public void Hello()
{
String SOAP_ACTION = "http://tempuri.org/Hello";
String METHOD_NAME = "Hello";
String NAMESPACE = "http://tempuri.org/";
String URL = "http://10.0.2.2/MainService/MainService.asmx";
try {
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
HttpTransportSE transport= new HttpTransportSE(URL);
transport.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
MyText.setText(resultString.toString());
}catch(Exception ex) {
MyText.setText("Error: " + ex.getMessage());
}
}[/HIGH]
All this does is catch an exception with the message "Null".
Note that I am not an android developer, this is my very first project.
Can anyone tell me what I did wrong. Thanks is advance.
P.S I did the same thing with Netbeans and regular Java and it works perfectly.
[HIGH]public void Hello()
{
String SOAP_ACTION = "http://tempuri.org/Hello";
String METHOD_NAME = "Hello";
String NAMESPACE = "http://tempuri.org/";
String URL = "http://10.0.2.2/MainService/MainService.asmx";
try {
SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
HttpTransportSE transport= new HttpTransportSE(URL);
transport.call(SOAP_ACTION, soapEnvelope);
SoapPrimitive resultString = (SoapPrimitive)soapEnvelope.getResponse();
MyText.setText(resultString.toString());
}catch(Exception ex) {
MyText.setText("Error: " + ex.getMessage());
}
}[/HIGH]
All this does is catch an exception with the message "Null".
Note that I am not an android developer, this is my very first project.
Can anyone tell me what I did wrong. Thanks is advance.
P.S I did the same thing with Netbeans and regular Java and it works perfectly.