android ksoap2 Caused by: java.lang.RuntimeException: Cannot seralize (double data type)

by mindus » Thu, 30 Sep 2010 14:18:46 GMT


Sponsored Links
 Hi
In my project i am using ksoap2-android-assembly-2.4-jar-with-
dependencies.jar for web service purpose.

I got able to access the service and passing simple parameters and get
the objects and iterate it.

But the problem is i cant able to send the complex object. Can anybody
know how to pass the complex object with date and double values.

Employee object have string name, int number, double salary and Date
dateOfBirth.

And the employee object implements KvmSerializable
name="Mike"
number=2;
salary=20000
dateOfBirth = new Date();

and the code is

SOAP_ACTION = "http://xysed/GetHRA";
METHOD_NAME = "GetHRA";

TextView authenticate = new TextView(this);

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

PropertyInfo pi = new PropertyInfo();
pi.setName("employee");
Employee e = new Employee();
e.setNumber(4);
e.setName("Ananth");
e.setSalary(20000);
e.setDob(new Date());
pi.setValue(e);
pi.setType(Employee.EMPLOYEE_CLASS);
request.addProperty(pi);
request.addProperty("employee", e);


SoapSerializationEnvelope envelope = new
SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
Marshal dateMarshal = new MarshalDate();
dateMarshal.register(envelope);
//envelope.addMapping(Employee.NAMESPACE, "Employee", new
Employee().getClass());
try {
AndroidHttpTransport androidHttpTransport = new
AndroidHttpTransport(URL);
androidHttpTransport.call(SOAP_ACTION, envelope);

//String fullName = (String)envelope.getResponse();
Log.v("Full String :", envelope.getResponse().toString());
Log.v("body in :", envelope.bodyIn.toString());
Log.v("body out :", envelope.bodyOut.toString());

authenticate.setText(envelope.getResponse().toStri ng());
this.setContentView(authenticate);

} catch (IOException ioe) {
ioe.printStackTrace();
} catch (XmlPullParserException xpe) {
xpe.printStackTrace();
}



I pass this employee object as a request i got an error like

java.lang.RuntimeException: Unable to start activity
ComponentInfo{com.oak.soap.test/com.oak.soap.test.WebserviceDisplay}:
java.lang.RuntimeException: Cannot serialize: 20000.0

here 20000.0 is a salary ( double value)

ERROR/AndroidRuntime(287): Caused by: java.lang.RuntimeException:
Cannot serialize: 20000.0


Can anybody provide samples for how to pass complex object as request
to web service

Thanks
mindus

--



Other Threads

1. Background activities

What is the simplest, correct way to implement an application with
background semantics similar to the media player?  To  the user it
should appear as an activity which can be kept running in the
background and "iconized" to the notification bar whenever the
activity is not on top of the stack or until stopped explicitly.

I guess some of the choices would be:

a) An activity which ignores onPause/onStop and just keeps doing
whatever it is doing (simple, but I suspect not the recommended
way...)
b) Activity + in-process service
c) Activity + service with its own process

Assuming the solution involves a service, what are the choices for
sharing a fair amount of state between the activity and its service?
Can they just access shared objects (how to set that up) or does it
require an AIDL RPC interface storing everything in a database
instead?

Bernhard
--~--~---------~--~----~------------~-------~--~----~

2. Porting Android to GPS devices

True! I have been thinking about it myself but wasn't sure how to go
about it.

Are you working on this port in open source space?

Cheers,
R



--~--~---------~--~----~------------~-------~--~----~
unsubscribe: [EMAIL PROTECTED]
website: 

3. loading multiple thumbnail images: Java API vs. WebKit

4. How come PICK doesn't seem to work on Contacts.CONTENT_URI?

5. How to fill an autocomple with information from a database query

6. WPA support

7. Why a custom view doen't visible?