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. Google translate update

Mantap!
Berguna banget kang buat saya..
Secara cuma bisa 2 bahasa...indonesia dan bahasa cinta...*halah*
@yopiesuryadi
www.jeruknipis.com/forum

-----Original Message-----
From: lucky sebastian <9b.andr...@gmail.com>
Date: Wed, 31 Mar 2010 08:30:10 
To: Android<id-android@googlegroups.com>
Subject: [id-android] Google translate update

Guys
Skarang google translate ada tambahan langsung bisa translate dari sms.
Cocok buat yg perlu ngerubah sms dr indo ke bahasa lain, misal spanyol atau
china buat gagah2 an dan musingin org lain hahaha.

Check out Google Translate at
http://market.android.com/search?q=pname:com.google.android.apps.translate

Salam,

Lucky Sebastian

-- 
"Indonesian Android Community [id-android]" 

2. OMA DRM 1.0 suppor

Hello all,

I have gotten some quick answers to my priliminary questions.  I am
looking forward to get answers on following.

1)  How the protected ringtones work on android?  I am interested in
the flow and details on middleware.
2)  How the pipeline gets constructed while playing ringtones?
3)  What are the interactions perfromed between media player and
middleware for protected scenarios?

Thank you in advance.

-sn

To unsubscribe from this group, send email to 
android-security-discuss+unsubscribegooglegroups.com or reply to this email 
with the words "REMOVE ME" as the subject.

3. onkey automation tool script help documentation

4. Monkey automation script documentation for user own monkey script

5. Deploying shared resources

6. Monkey automation script documentation

7. Buat Penggemar Villain Rom Hero