I tried to make a simple ksoap2 tutorial. This is a link
My problem is that I only get the answer if I use SoapPrimitive and Ksoap ... 2.6.4.jar with Ksoap ... 2.4.jar and "SoapObject response = (SoapObject) envelope.getResponse ();" I have an exception.
How should I use SoapObject?
This is my code:
public class WS_Auth_ComplexObjectsActivity extends Activity { String NAMESPACE = "http://WS.androidroleplay.fk4.de.hs_bremen.de"; String METHOD_NAME = "GetSumOfTwoInts"; String SOAP_ACTION = "http://WS.androidroleplay.fk4.de.hs_bremen.de/GetSumOfTwoInts"; String URL = "http://192.168.178.28:8080/WebProject_DB16/services/HelloWorldWS?wsdl"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME); PropertyInfo pi = new PropertyInfo(); pi.setName("Operand1"); pi.setValue(2); pi.setType(int.class); Request.addProperty(pi); PropertyInfo pi2 = new PropertyInfo(); pi2.setName("Operand2"); pi2.setValue(5); pi2.setType(int.class); Request.addProperty(pi2); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); envelope.setOutputSoapObject(Request);
And this is my web service:
public class HelloWorldWS { public int GetSumOfTwoInts(int Operand1, int Operand2 ) { System.out.println(Operand1+ " + "+ Operand2 +" = "+ (Operand1 + Operand2)); return Operand1 + Operand2; } }
source share