erkandoner
Lurker
Hi!
I have an Android app consuming asp.net web services. It works fine when I call asp.net ws that requires no parameter passing.
But another asp.net ws requires parameter passing, and I send the parameters, but it receives the parameters as null values. I debugged and saw that Android app send the parameters correctly. Asp.net ws takes parameters as null values, and send the response back without taking these variables into account.
The Android app code:
SoapSerializationEnvelope envelope =
AndroidHttpTransport androidHttpTransport =
SoapObject response = (SoapObject) envelope.
}
I have an Android app consuming asp.net web services. It works fine when I call asp.net ws that requires no parameter passing.
But another asp.net ws requires parameter passing, and I send the parameters, but it receives the parameters as null values. I debugged and saw that Android app send the parameters correctly. Asp.net ws takes parameters as null values, and send the response back without taking these variables into account.
The Android app code:
package
com.wsImpl;
import
org.apache.http.client.HttpClient;
import
org.ksoap2.SoapEnvelope;
import
org.ksoap2.serialization.SoapObject;
import
org.ksoap2.serialization.SoapSerializationEnvelope;
import
org.ksoap2.transport.AndroidHttpTransport;
import
android.app.Activity;
import
android.os.Bundle;
import
android.widget.ArrayAdapter;
import
android.widget.AutoCompleteTextView;
public
class ErkActivity7 extends Activity {
private static final String NAMESPACE = "http://artisinerji.com";
private static final String URL = "http://192.168.5.68:8080/erkService.asmx";
private static final String SOAP_ACTION = "http://artisinerji.com/GetSumOfTwoInts";
private static final String METHOD_NAME = "GetSumOfTwoInts";
private static final String[] sampleACTV = new String[] { "android",
"iphone", "blackberry" };
private static final String NAMESPACE = "http://artisinerji.com";
private static final String URL = "http://192.168.5.68:8080/erkService.asmx";
private static final String SOAP_ACTION = "http://artisinerji.com/GetSumOfTwoInts";
private static final String METHOD_NAME = "GetSumOfTwoInts";
private static final String[] sampleACTV = new String[] { "android",
"iphone", "blackberry" };
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayAdapter<String> arrAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, sampleACTV);
AutoCompleteTextView ACTV = (AutoCompleteTextView) findViewById(R.id.AutoCompleteTextView01);
ACTV.setAdapter(arrAdapter);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
int num1 = 3; int num2 = 5;
request.addProperty("num1",num1);
request.addProperty("num2",num2);
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ArrayAdapter<String> arrAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_dropdown_item_1line, sampleACTV);
AutoCompleteTextView ACTV = (AutoCompleteTextView) findViewById(R.id.AutoCompleteTextView01);
ACTV.setAdapter(arrAdapter);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
int num1 = 3; int num2 = 5;
request.addProperty("num1",num1);
request.addProperty("num2",num2);
SoapSerializationEnvelope envelope =
new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
envelope.setAddAdornments(
true);
AndroidHttpTransport androidHttpTransport =
new AndroidHttpTransport(URL);
try {
androidHttpTransport.call(SOAP_ACTION, envelope);
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapObject response = (SoapObject) envelope.
bodyIn;
String result = response.getProperty(0).toString();
ACTV.setHint(
ACTV.setHint(
"Receivedddd: " + result.toString());
} catch (Exception e) {
e.printStackTrace();
ACTV.setHint("An Error Occured:" + e.getMessage());
}
}
} catch (Exception e) {
e.printStackTrace();
ACTV.setHint("An Error Occured:" + e.getMessage());
}
}
}