Hi Manfred,
Please please put also an example how to pass an array of ints in the
Soap Request. My undergraduate uni project depends on it and I can't
do it with current version of KSOAP2 because of constant serialization
errors :(
Basically I fail to send this:
request.addProperty("dataIndexIDs", new int[] {63, 62}); // throws
RuntimeException: Cannot serialize
I'm awaiting your prompt help.
Kind regards
Thomas
On Mar 7, 6:45 pm, Manfred Moser <
mosa...@gmail.com> wrote:
> Yes... but not with me. Will supply some stuff on the wiki later this
> week..
>
> manfred
>
> On Mon, Mar 7, 2011 at 9:50 AM, naresh pasnur <
nareshpas...@gmail.com>wrote:
>
> > Hi Manfred,
>
> > Do you have an working example of parsing soapobjects in code manually ?
>
> > Thanks,
> > Naresh
>
> > On Sun, Mar 6, 2011 at 9:30 PM, Manfred Moser <
mosa...@gmail.com> wrote:
>
> >> Sorry... I do not have a marshalling example. I would have to write and
> >> test it myself. But I know others on the list have done it.
>
> >> Personally I am just parsing the soapobjects in code manually and that
> >> works fine. You can always fall back to that..
>
> >> manfred
>
> >> On Sun, Mar 6, 2011 at 3:09 PM, naresh pasnur <
nareshpas...@gmail.com>wrote:
>
> >>> Hi Manfred,
>
> >>> I'm really having hard time getting this to work. Please help me with
> >>> this one.
> >>> Do you have any working example of Marshalling a String[] ?
>
> >>> Thanks
>
> >>> My relevant code snippet:
>
> >>> *Android webservice client :*
> >>> import org.ksoap2.serialization.SoapObject;
>
> >>> SoapObject request;
> >>> request = new SoapObject(NAMESPACE, WEBSERV_METHOD);
>
> >>> String[] mSkuList = new String[2]
>
> >>> mSkuList[0] = "123456";
> >>> mSkuList[1] = "456789";
>
> >>> request.addProperty("n0:skuList", mSkuList);*// throws error over here.
> >>> Cannot serialize String[]*
>
> >>> SoapSerializationEnvelope envelope = new
> >>> SoapSerializationEnvelope(SoapEnvelope.VER11);
> >>> envelope.setOutputSoapObject(request);
> >>> AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport
> >>> (WEBSERV_URL);
> >>> try {
> >>> androidHttpTransport.call(SOAP_ACTION, envelope);
> >>> result = (SoapObject) envelope.bodyIn;
> >>> }
> >>> catch(Exception e){
> >>> //
> >>> }
>
> >>> *Java webservice:*
> >>> public String getSku(String[] skuList)
> >>> {
> >>> //processing code
> >>> return result;
>
> >>> On Thu, Mar 3, 2011 at 2:56 AM, Manfred Moser <
mosa...@gmail.com> wrote:
> >>>>> On Wed, Mar 2, 2011 at 7:37 PM, Manfred Moser <
mosa...@gmail.com>wrote:
>
> >>>>>> I have not done this before so I am guessing. I would just switch on
> >>>>>> debugging and see if the request is what you expect on the server first.
> >>>>>> (see the wiki how to debug)
>
> >>>>>> Then see if that arrives on the server fine.
>
> >>>>>> Then see how the response gets assembled and how it arrives..
>
> >>>>>> Hope that helps..
>
> >>>>>> manfred
>
> >>>>>> PS: If anybody has done this it would be great if you could put it
> >>>>>> here or on the wiki..
>
> >>>>>> On Wed, Mar 2, 2011 at 3:24 PM, naresh pasnur <
nareshpas...@gmail.com
> >>>>>> > wrote:
>
> >>>>>>> Just to make it clear I have mentioned my code below: Thanks
>
> >>>>>>> *Android webservice client :*
> >>>>>>> import org.ksoap2.serialization.SoapObject;
>
> >>>>>>> SoapObject request;
> >>>>>>> request = new SoapObject(NAMESPACE, WEBSERV_METHOD);
>
> >>>>>>> String[] mSkuList = new String[2]
>
> >>>>>> mSkuList[0] = "123456";
> >>>>>>> mSkuList[1] = "456789";
>
> >>>>>>> request.addProperty("n0:skuList", mSkuList);
>
> >>>>>>> SoapSerializationEnvelope envelope = new
> >>>>>>> SoapSerializationEnvelope(SoapEnvelope.VER11);
> >>>>>>> envelope.setOutputSoapObject(request);
> >>>>>>> AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport
> >>>>>>> (WEBSERV_URL);
> >>>>>>> try {
> >>>>>>> androidHttpTransport.call(SOAP_ACTION, envelope);
> >>>>>>> result = (SoapObject) envelope.bodyIn;
> >>>>>>> }
> >>>>>>> catch(Exception e){
> >>>>>>> //
> >>>>>>> }
>
> >>>>>>> *Java webservice:*
> >>>>>>> public String getSku(String[] skuList)
> >>>>>>> {
> >>>>>>> //processing code
> >>>>>>> return result;
> >>>>>>> }
>
> >>>>>>> On Wed, Mar 2, 2011 at 6:10 PM, naresh pasnur <
> >>>>>>>
nareshpas...@gmail.com> wrote:
>
> >>>>>>>> I want to pass a string array in the request.
>
> >>>>>>>> On Wed, Mar 2, 2011 at 6:01 PM, Manfred Moser <
mosa...@gmail.com>wrote:
>
> >>>>>>>>> Ok... do you want to submit a string array in the request or parse
> >>>>>>>>> it out in the response..
>
> >>>>>>>>> On Wed, Mar 2, 2011 at 2:59 PM, naresh pasnur <
> >>>>>>>>>
nareshpas...@gmail.com> wrote:
>
> >>>>>>>>>> Thanks for your reply.
> >>>>>>>>>> Do I need to parse the soapobject array in the java webservice ?
> >>>>>>>>>> Also, what parameter should I use for the web service method
> >>>>>>>>>> instead of String[].
>
> >>>>>>>>>> Please see the code snippet in short:
>
> >>>>>>>>>> *Java webservice:*
> >>>>>>>>>> public String getSku(String[] skuList)
> >>>>>>>>>> {
> >>>>>>>>>> //processing code
> >>>>>>>>>> return result;
> >>>>>>>>>> }
>
> >>>>>>>>>> *Webservice client in Android:*
> >>>>>>>>>> SoapObject request;
> >>>>>>>>>> String[] mSkuList = new String[2];
> >>>>>>>>>> mSkuList[0] = “123456″;
> >>>>>>>>>> mSkuList[1] = “456789″;
> >>>>>>>>>> PropertyInfo pi = new PropertyInfo();
> >>>>>>>>>> pi.setName(“n0:skuList”);
> >>>>>>>>>> pi.setValue(mSkuList);// not working
> >>>>>>>>>> request.addProperty(pi);
>
> >>>>>>>>>> Best Regards,
>
> >>>>>>>>>> Naresh
>