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. Pixelpipe Post & Upload Lite

Upload Photos and post to Blog & Status services directly from your
Android with Pixelpipe Lite & get your content out to your favorite
social network, blog and photo sites. Supported services include
Facebook, Flickr, Picasa, Blogger, Twitter, hi5, Photobucket, TwitPic,
TinyPic, yfrog, Evernote, Xanga, Pixel Pipe.

Price FREE, Version 1.3, Downloads 5,000-10,000, Size 543964, Category Social

Sumber: cyrket

Salam,
Benny

--~--~---------~--~----~------------~-------~--~----~
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group, please visit the following page:
 

2. Did Google fumble the Android 1.6 launch?

We were thrilled last week when T-Mobile started rolling out Android
1.6, but we were also shocked that the update came without warning.
Developers were also surprised with how soon the update started
appearing. Everyone knew Android 1.6 was looming, but there was no
public date for its availability.

Did Google fumble the Android 1.6 launch?

1. The update caught developers off guard.

Developers knew the update was coming, but many had not released
updates for their applications. This is a problem because Android 1.6
causes problems with many apps and they need to be updated in order to
be compatible.

Google normally sends an email to all developers who register with
Android Market in order to warn them, but that did not happen this
time around.

Some customers experienced severe problems when they updated to
Android 1.6 because they had apps installed that were not compatible
with the update.

2. Google uploaded the wrong 1.6 images on HTC site.

Google uploaded the developer images of Android 1.6 to HTC site only
two days before the over the air update began. Unfortunately, the
wrong images were uploaded at first, which caused further confusion
among developers.

3. Android 1.6 breaks many apps in ADC2.

The Android Developers challenge is in the middle of the first round
of voting. According to the official rules of the contest,
applications can not be upgraded after they are submitted. All of the
applications were designed for Android 1.5 so the new update to
Android 1.6 makes these apps unusable.

Hopefully Google will do something to address this.

Having Problems with Android 1.6?
If you are experiencing force close loops, you can boot your phone
into safe mode and uninstall the offending software.

Power off your phone
Hold down Menu and then power on your phone
Keep holding Menu down until Android boots and you see safe mode
displayed on your desktop
Go to Settings > Applications > Manage Applications and uninstall
problem software
If you experience an application that has problems, please email the
developer. Many problems can be easily fixed, but the dev needs to be
aware that problems exist.

The following is a list of applications that users have reported
problems with Android 1.6. Not all have been verified. Let us know if
any get fixed and we will update it.

Open Home (Fixed)
Useful Switchers
Facebook
Panda Home
Appmanager Pro
CoPilot
Handcent
Twidroid
Toggle Settings
It appears apps that use GPS, home replacement apps, and some apps
with native Android tabs are having issues.

If you know of an app that does not work with Android 1.6, leave a
comment and we will add it to the list.


Sumber: androidandme

Salam,
Benny

--~--~---------~--~----~------------~-------~--~----~
Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group, please visit the following page:
 

3. android store support

4. Looping through contacts with reading each contact default phone

5. bringing an app to the foreground...

6. Help needed: Emulator does not show up

7. Internet radio+source code