Serialization problem ,with ksoap

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Serialization problem ,with ksoap

Postby sooraj.rit » Tue Feb 03, 2009 12:04 pm

Hi i want to implement a webmethod to search some data and I have done it well in . Now i want to access that method from android . The real problem I am facing is that, I have to use a complex data type. ( a class containing two strings ). when I call the webmethod, an exception is thrown (Runtime exception saying -" cannot serialize my class "). I have attached my code.pls help me.

I am using a class to hold my data as

String PatName;
String PatID;

and in my java code

public class SearchData extends Activity
private static final String SOAP_ACTION = "";
private static final String METHOD_NAME = "GetPatDetails";
private static final String NAMESPACE = "";
private static final String URL = "";
PAT_DETAILS m_PatDetails;

public void onCreate( Bundle savedInstanceState )
m_PatDetails.PatName = "John";
m_PatDetails.PatID ="123";

SoapObject request = new SoapObject( NAMESPACE, METHOD_NAME );
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11 );
envelope.dotNet = true;

request.addProperty( "patDetails", m_PatDetails );

envelope.setOutputSoapObject( request );
HttpTransportSE htransport = new HttpTransportSE( URL );

{ SOAP_ACTION, envelope ); // throws exception
catch( IOException exp )
SoapObject ResultRequestSOAP = (SoapObject)envelope.bodyIn;

// Remaining codesnippet here......
catch ( Exception aE )
aE.printStackTrace (); //Runtime exception here - "cannot serialize my class "

Pls help
Posts: 5
Joined: Tue Jan 13, 2009 12:29 pm
Location: Trivandrum,India


Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 6 guests