i already done with my asmx which developed by using .net c# and it works well
but i found a error when i need to call the by using java android error: java.lang.ClassCastException:org.ksoap2.serialization.SoapObject cannot be cast to org.ksoap2.serialization.SoapPrimitive
result displayed at my asmx:
<customer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
<customerID>1</customerID>
<companyName>ABC</companyName>
<contactName>Jack</contactName>
<customerID>2</customerID>
<companyName>SS Company</companyName>
<contactName>Mary</contactName>
</customer>
my java cs:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tv = (TextView)findViewById(R.id.textView1);
SoapObject Request = new SoapObject (NAMESPACE, METHOD_NAME);
Request.addProperty("custID", "member");
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);
try
{
aht.call(SOAP_ACTION, soapEnvelope);
SoapObject resultString = (SoapObject) soapEnvelope.getResponse();
tv.setText(resultString.toString());
}
catch(Exception e)
{
tv.setText(e.toString());
}
}
the code above is functioning if i use http://www.w3schools.com/webservices/tempconvert.asmx
I have solved it
SoapObject resultString = (SoapObject) soapEnvelope.getResponse();
String addon = "";
for(int i =0;i<resultString.getPropertyCount();i++)
{
SoapObject array2 = (SoapObject) resultString .getProperty(i);
addon = (addon + "ID = " + array2.getProperty(0).toString() + array2.getProperty(1).toString() + array2.getProperty(2).toString() + "\n");
}
tv.setText(addon.toString());