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 (It can be found at
I receive a XML result which looks quite reasonable to me.

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

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; = "CustomerID";
case 1:
info.type = PropertyInfo.STRING_CLASS; = "FirstName";


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

public int getPropertyCount() {
return 2;

public void setProperty(int index, Object value) {

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


private static final String SOAP_ACTION = "
private static final String METHOD_NAME = "ReturnCustomerObject2";
private static final String NAMESPACE = "";
private static final String URL = "http://";

public Boolean ExecuteSoapAction() {
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope
envelope.encodingStyle = SoapSerializationEnvelope.XSD;
"ReturnCustomerObject2", new Customer().getC

Other Threads

1. are generics (for numeric types) a good idea?

Hi Everyone.

I'm just wondering if using generics in a class's definition is a good idea
in Android. What I'm inclined to do is define some class that stores and
operates on some numeric types.  I want to be able to instantiate an
integer, long, float, or double version of this class.  So I want the
int'ified version of this object to only store an int, instead of casting
the ints from the constructor to a long; and same thing for float/double
too. This way I minimize the amount of allocated space per number. So anyway
this is perfectly achievable with generics... but I always get nervous
thinking about generics and numeric types since every time I pass an int
argument to a method that takes a Number as an argument, it'll be turned
into an Integer, and then that Integer will have to be cleaned up later.

So is it a good idea to use generics for primitive numeric types in Android
or will it cause ugly unnecessary garbage collection?

Thanks, Rob


2. Touchscreen causes force stop after resuming from pause

Hi, I have been developing a game for some time now. The game uses the
touch screen. Everything works fine in the first instance, I can pause
and resume. On resume, the application seems to be running as normal
i.e. the timer has got the correct state etc and continues to
decrease. The problem I have is when I re-touch the surface. the
onTouch function is called and fails. I have seen from the logcat file
that I have the following errors.

 Key dispatching timed out sending to com.blastem/com.blastem.Blastem
W/WindowManager(   65): Previous dispatch state: {{KeyEvent{action=1
code=82 repeat=0 meta=0 scancode=229 mFlags=8} to Window{43ef2108
Keyguard paused=false} @ 1287329205888 lw=Window{43ef2108 Keyguard
paused=false} lb=android.view.viewroo...@43f508c0 fin=false gfw=true
ed=true tts=0 wf=false fp=false mcf=Window{43ef2108 Keyguard
W/WindowManager(   65): Current dispatch state: {{null to
Window{4401c918 com.blastem/com.blastem.Blastem paused=false} @
1287329318945 lw=Window{4401c918 com.blastem/com.blastem.Blastem
paused=false} lb=android.os.binderpr...@44015918 fin=false gfw=true
ed=true tts=0 wf=false fp=false mcf=Window{4401c918 com.blastem/
com.blastem.Blastem paused=false}}}
I/Process (   65): Sending signal. PID: 277 SIG: 3

Do I need to save the state of the View or something similar.
I think I understand the error but am most likely being stupid. I
would very happy if someone could help me with this issue. I would not
normally ask unless I was really stuck.

Thanks in advance,
Karl Evans


3. soft keyboard event (or detection)

4. https webview

5. AndroisSOAP startup (PoC)

6. Android canvas setMatrix(null) crashes (if preceded by a getMatrix)

7. onCellLocationChanged() not called