MavyaSoni / ksoap2-android

Automatically exported from code.google.com/p/ksoap2-android
0 stars 0 forks source link

ksoap2 does not serialize Object[] #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Problem: ksoap2 does not serialize Object[]

What steps will reproduce the problem?
1.create a web service with a methode with a parameter which is an array of
objects
2.create an object (which extends SoapObject) client side, with that array
of objects into its properties.
3. perform a soap call passing that object

What is the expected output? What do you see instead?
I expect  my array of objects to be serialized into the soapEnvelope.
Instead i see that serialization throws an Exception. 

What version of the product are you using? On what operating system?
i am using ksoap2-android-assembly-2.4-jar-with-dependencies.jar under
Linux/Ubuntu, IDE Eclipse

Please provide any additional information below.

Original issue reported on code.google.com by t.cim...@gmail.com on 17 May 2010 at 5:12

GoogleCodeExporter commented 8 years ago
I have same problem when i add more than 1 parameter. 
SoapObject Reques = new SoapObject(NAMESPACE,METHOD_NAME);

Reques.addProperty("sUserName", "trunghd");
Reques.addProperty("sPass", "123456");

This problem occur in this line

SoapPrimitive resultString = (SoapPrimitive)soapEnveloper.getResponse();

Original comment by hoangdinhtrung on 24 May 2010 at 10:56

GoogleCodeExporter commented 8 years ago
I solved bugs extending SoapObject with a new class created by me, named 
DataSoapObject; and SoapEnvelope with DataSoapEnvelope

Here you can find:
- slides to describe the usage  (in italian)   
https://docs.google.com/present/edit?id=0AXhqPVi3vJT6ZGZxaDdwYl83OGN2czlkM2Q4&hl
=en

- sources of my two class 
https://docs.google.com/leaf?id=0B3hqPVi3vJT6ODRiYTNkODAtM2Q3YS00YmVjLTk1ODMtYmR
iNmRkYjU1NzMy&hl=en

-completed sources: karlmdavis sources plus sources of my two classes
https://docs.google.com/leaf?id=0B3hqPVi3vJT6ODRiYTNkODAtM2Q3YS00YmVjLTk1ODMtYmR
iNmRkYjU1NzMy&hl=en

- completed jar: ksoap2.jar plus my two classes  
https://docs.google.com/leaf?id=0B3hqPVi3vJT6ZDNjZmU3YTAtZmI5Zi00Nzg1LWFjZWUtNjM
3OGEyNTE3OTlm&hl=en

- example of usage: a client on android platfrom and a service with Axis2
https://docs.google.com/leaf?id=0B3hqPVi3vJT6ZTcxMTE4MjMtYTkzNS00MjdjLTg1NGYtNTE
wZDljZjY3YTdl&hl=en&authkey=COiiifYC

I hope it helps.

Original comment by t.cim...@gmail.com on 1 Sep 2010 at 8:42

GoogleCodeExporter commented 8 years ago
Could you provide these in a github clone so that I can pull them in easily and 
add the sample code as a test class maybe? Otherwise you could put the example 
on a wiki page as well. 

Original comment by mosa...@gmail.com on 12 Oct 2010 at 5:39

GoogleCodeExporter commented 8 years ago

Original comment by mosa...@gmail.com on 12 Oct 2010 at 6:59

GoogleCodeExporter commented 8 years ago

Original comment by mosa...@gmail.com on 21 Oct 2010 at 4:44

GoogleCodeExporter commented 8 years ago
That is a nice suggestion, thank you, but  i do not have time now. Maybe later.

Original comment by t.cim...@gmail.com on 21 Oct 2010 at 7:24

GoogleCodeExporter commented 8 years ago
Do you think I should just add the classes to the package or are they not that 
different from the core SoapObject so it should just be patched?

Original comment by mosa...@gmail.com on 4 Nov 2010 at 8:00

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
It would be better to patch the original SoapObject and SoapEnvelope.
I created the two new classes because i could not modify the original ones.

Please, try to test it before including it in the library. Some students of 
mine used the patched library so i can say that it "generally" works well, but 
the tests were not exaustive.

Original comment by t.cim...@gmail.com on 4 Nov 2010 at 8:34

GoogleCodeExporter commented 8 years ago
I wont have time to do the testing nor creating the patch. Cant you ask some of 
your students to do it in a clone on github ;-)

Original comment by mosa...@gmail.com on 4 Nov 2010 at 8:37

GoogleCodeExporter commented 8 years ago
Maybe.
Or, if i modify the original files, and test them, then you could create the 
new patch?

I will try to do something. 

Original comment by t.cim...@gmail.com on 4 Nov 2010 at 10:46

GoogleCodeExporter commented 8 years ago
The best way to do that is to clone the repository on github. Do your 
development there and then just create a pull request or email me about it and 
I can pull it in. That would be awesome. Let me know if you need any help with 
github or so.

Original comment by mosa...@gmail.com on 4 Nov 2010 at 10:54

GoogleCodeExporter commented 8 years ago
And yes.. if you modify the original files and just send them to me I can apply 
the change as well. Whatever is easiest for you.

Original comment by mosa...@gmail.com on 4 Nov 2010 at 11:17

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi.
i prepared modified sources, for you to upload to the project.
I refer to source version karlmdavis-ksoap2-android-3d576b5_src and jar version 
 ksoap2-android-assembly-2.4-jar-with-dependencies.jar.

I patched  org.ksoap2.serialization.SoapSerialization Envelope and i created a 
new file org.ksoap2.serialization.DataSoapObject.

So DataSoapObject should be added to the project as a new file; and 
SoapSerializationEnvelope should be modified.

I described the use of DataSoapObject here : 
http://people.unica.it/bart/2010/12/03/ksoap2-patch-for-user-defined-objects-and
-arrays/

Here you can find: 
* 
https://docs.google.com/leaf?id=0B3hqPVi3vJT6NTM1MGQwODEtYTc0MS00ZjJkLThlMWEtMzE
zZWU2ODc0MTRj&hl=en 
the sources  of org.ksoap2.serialization.SoapSerializationEnvelope and 
org.ksoap2.serialization.DataSoapObject
* 
https://docs.google.com/leaf?id=0B3hqPVi3vJT6YWI1NzA1NDAtZTQ3MS00OTNhLTljNjItZGY
2OTczYTRmNjJl&hl=en" 
the jar of my patch (it consist of the 
ksoap2-android-assembly-2.4-jar-with-dependencies.jar with added DataSoapObject 
and substitued DataSerializationEnvelope)

Should you please apply the modification to the project?
Please, let me know if everything is ok.
Thank you

Original comment by t.cim...@gmail.com on 6 Dec 2010 at 10:03

GoogleCodeExporter commented 8 years ago
Hi! 

I tried to apply your changes but found that they are not based off the latest 
version in github and that the patch uses Java generics. Since this project is 
still Java 1.3 compatible it will not build that way.

Please ensure that you base your patch off the latest version in github 
(ideally create a clone and modify in your clone and then create a pull 
request) and make sure that the project can actually be built.

Original comment by mosa...@gmail.com on 7 Dec 2010 at 5:19

GoogleCodeExporter commented 8 years ago

Original comment by mosa...@gmail.com on 23 Mar 2011 at 6:38

GoogleCodeExporter commented 8 years ago

Original comment by mosa...@gmail.com on 24 Mar 2011 at 5:04

GoogleCodeExporter commented 8 years ago
This should work now with a contribution from Andrew Oppenlander. See wiki and 
latest github. Will make it into a 2.5.5 release.

Original comment by mosa...@gmail.com on 27 May 2011 at 4:55

GoogleCodeExporter commented 8 years ago
That's great!

Original comment by t.cim...@gmail.com on 27 May 2011 at 4:58

GoogleCodeExporter commented 8 years ago
It is however not this patch supplied by t.cim... sincethat never built. If you 
want that added you will have to provide a working build in pull request or 
patch.. 

Original comment by mosa...@gmail.com on 27 May 2011 at 5:02

GoogleCodeExporter commented 8 years ago

Original comment by mosa...@gmail.com on 23 Aug 2011 at 5:12

GoogleCodeExporter commented 8 years ago
Please help me request a object to webservice?
this is webservice

POST /erptransactionservices/POS/WSOutputReceipt.asmx HTTP/1.1
Host: 115.78.131.151
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/AddClass"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <AddClass xmlns="http://tempuri.org/">
      <objClass>
        <ClassName>string</ClassName>
        <Quantity>int</Quantity>
      </objClass>
    </AddClass>
  </soap:Body>
</soap:Envelope>

Original comment by dinhhieuac@gmail.com on 12 Dec 2011 at 8:22

GoogleCodeExporter commented 8 years ago
Please post to the mailing list for question and read the documentation before 
you ask for help.

Original comment by mosa...@gmail.com on 12 Dec 2011 at 6:13