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. Two Problems with ExpandableListView

Very pleased  :) with the way ExpandableListView works but am unclear
how to set the clicked view as invalid in OnDismiss.

Problem One
-------------------

In the onChildClick(ExpandableListView parent, View v, int
groupPosition, int childPosition, long id)
{
I call the Dialog "Enter" and wait for dismiss so:-

Value = new Value_Input(test2.this,0, custno, itemno, day);
            Value.show();
            Value.setOnDismissListener(new OnDismissListener() {
            public void onDismiss(DialogInterface arg0) {
                getExpandableListView().invalidateViews();
            }
            });

}

the invalidateViews() seems a bit heavyweight when I only want to
redraw the clicked view.

the other options are:-

getExpandableListView().invalidate();
getExpandableListView().invalidate(dirty);
getExpandableListView().invalidate(l, t, r, b)
getExpandableListView().invalidateChild(child, dirty)
getExpandableListView().invalidateChildInParent(location, dirty)
getExpandableListView().invalidateDrawable(drawable)

basically how do I get from groupPosition, childPosition to the View
after the event??
or how to use one of the above??

What I  need is:-

                  getExpandableListView().invalidateChild
( groupPosition, childPosition)

Problem Two
------------------

How do I get the adapter not to draw GONE views.  I have tried the
trick I used in the simple BaseAdapter in both getGroupView and
getChildView but it does not work :-

                boolean found=false;
                int count = getExpandableListView().getChildCount();
                for(int i=0;i<count;i++){
                        View block2 = 
(View)getExpandableListView().getChildAt(i);
                        if (block2.getVisibility()==View.GONE){
                            found=true;
                        }
                }
                if (found){
                        getExpandableListView().forceLayout();
                        getExpandableListView().getParent().requestLayout();
                        getExpandableListView().invalidateViews();
                }

What do I do???  Why doesn't the adapter look after this for me??

I would argue that both of the above problems currently require the
user to have an understanding of what is going on inside the adapter
other than the basics. (dangerous)  Or am I missing something basic??

Many thanks in advance
Steve



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

2. Adding a shortcut to Programs (launchers) programmatically

Hi,

I'd like to programmatically add shortcuts to "Applications" (list of
launchers) - typically these are added automatically when an
application is installed.

The shortcuts could be to native executables or to regular application
launchers/classes.

Is this possible at all? If so, could someone help me figure out how?

Thank you,
Ashutosh
--~--~---------~--~----~------------~-------~--~----~

3. interrupt dialog

4. SurfaceFlinger and SurfaceComposerClient problem.

5. call addFlags in xml

6. OpenGL ES - How to get the current ModelView matrix?

7. .Net support