Using KSoap2 with VB.Net webservice

by MaximG » Thu, 16 Apr 2009 00:56:29 GMT


Sponsored Links
 ello All,
I am having some serious difficulty using KSoap2 to connect to a
VB.Net webservice and am hoping I could get some help from someone who
is smarter than me. I have been trying to work this out for 2 weeks
with no luck.


So this is my problem. Using KSoap2 on the Android platform I have
successfully queried a super simple web service that I created using
vb.net (It can be found at
http://gershwinsolutions.ftpaccess.cc/2dowebservice.asmx)
I receive a XML result which looks quite reasonable to me.

ReturnCustomerObject2Response{
ReturnCustomerObject2Result=anyType{CustomerID=1; FirstName=This is a
test; };
}


However at the point where I try to cast the object I am returning
from the webservice into a KvmSerializable object (as required by
KSoap2) I receive a java.lang.ClassCastException.


This is my object (I have excluded imports for brevity):

public class Customer extends BaseObject {

private int m_CustomerID;
private String m_FirstName;
public static Class<? extends Customer> Customer_CLASS = new Customer
().getClass();



public void setCustomerID(int CustomerID) {
m_CustomerID = CustomerID;
}
public int getCustomerID() {
return m_CustomerID;
}
public void setFirstName(String FirstName) {
m_FirstName = FirstName;
}
public String getFirstName() {
return m_FirstName;
}


public void getPropertyInfo(int index, Hashtable properties,
PropertyInfo info) {
switch (index)
{
case 0:
info.type = PropertyInfo.INTEGER_CLASS;
info.name = "CustomerID";
break;
case 1:
info.type = PropertyInfo.STRING_CLASS;
info.name = "FirstName";
break;
default:
break;

}
}


@Override
public Object getProperty(int index)
{
switch (index) {
case 0:
return m_CustomerID;
case 1:
return m_FirstName;
default:
return null;
}
}

@Override
public int getPropertyCount() {
return 2;
}


@Override
public void setProperty(int index, Object value) {

switch (index) {
case 0:
m_CustomerID = Integer.parseInt(value.toString());
break;
case 1:
m_FirstName = value.toString();
break;
default:
break;
}

}
}


private static final String SOAP_ACTION = "http://tempuri.org/
ReturnCustomerObject2";
private static final String METHOD_NAME = "ReturnCustomerObject2";
private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "http://
10.0.2.2/2DoWebService.asmx";

public Boolean ExecuteSoapAction() {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope
(SoapEnvelope.VER11);
envelope.encodingStyle = SoapSerializationEnvelope.XSD;
envelope.setOutputSoapObject(request);
envelope.addMapping("http://tempuri.org/ReturnCustomerObject2",
"ReturnCustomerObject2", new Customer().getC



Other Threads

1. if current android supports 3GPP Rel-8 SMS extended character table?

As title,
If yes, how to verify it?

thanks.
--~--~---------~--~----~------------~-------~--~----~

2. Can i use RotateAnimation to make a Drawable rotate?

I want to draw some Drawables in a view, for example like Rect. Then I want
to make a totate animation for each Rect when it's be clicked.
I try to use RotateAnimation, but it not work. It look likes only can make a
View rotating.

so, how can I make this work?

thanks a lot


Bear

--~--~---------~--~----~------------~-------~--~----~

3. unable to add a new layout.xml

4. circular zoom in magic

5. latitude and longitude to Microdegrees

6. How to check if some email client is configured ?

7. running linux commands from java