0

I'm trying to send object as parameter to web service on java. It always throws a Runtime exception with Cannot serialize what is the best way to do that thx in advance

Marcos
  • 4,643
  • 7
  • 33
  • 60

2 Answers2

1

Take a look at this Complex Objects with Ksoap2 Essentially, the only thing you have to do is implement the KvmSerializable interface.

Marcos
  • 4,643
  • 7
  • 33
  • 60
1

Like as Ksoap2's page in google code, CodingTipsAndTricks part: To get this xml:

<users>
  <user>
     <name>Jonh</name>
     <age>12</age>
  </user>
  <user>
     <name>Marie</name>
     <age>27</age>
  </user>
</users>

You would do this:

SoapObject users = new SoapObject(NAMESPACE, "users");
SoapObject john = new SoapObject(NAMESPACE, "user");
john.addProperty("name", "john");
john.addProperty("age", 12);
SoapObject marie = new SoapObject(NAMESPACE, "user");
john.addProperty("name", "marie");
john.addProperty("age", 27);
users.addSoapObject(john);
users.addSoapObject(marie);
Oguz Ozkeroglu
  • 3,025
  • 3
  • 38
  • 64