I am using ksoap2 to call .net web services. The call works just fine, except when I pass parameters. Past parameters are always obtained as zero values by the web service. I don’t know what the problem is, I hope someone can help. Thank,
My code is below, please help me
package com.android.countrycode;
import org.ksoap2.SoapEnvelope;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.HttpTransportSE;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
public class CountryActivity extends Activity {
private static final String SOAP_ACTION = "http://www.webserviceX.NET/GetCountryByCountryCode";
private static final String OPERATION_NAME = "GetCountryByCountryCode";
private static final String WSDL_TARGET_NAMESPACE = "http://www.webserviceX.NET/";
private static final String SOAP_ADDRESS = "http://www.webservicex.net/country.asmx";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
TextView textView = new TextView(this);
setContentView(textView);
SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);
request.addProperty("CountryCode","AS");
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());
System.out.println(response.toString());
}
catch (Exception exception)
{
String exceptionStr=exception.toString();
textView.setText(exceptionStr);
System.out.println(exceptionStr);
Log.i("TAG",exceptionStr);
}
}
}
source
share