Search code examples
javaandroidweb-servicesksoap2ksoap

ksoap2 Set String[] to request.addProperty


When I use String[] a for add property in SoapSerializationEnvelope ,return error

 SoapObject request = new SoapObject(NAMESPACE, METHOD_SendArray);       

              //Use this to add parameters
              String[] a ={"21","22","23","66"};
              long[] x= new long[] { };
              request.addProperty("NumberList",a);
              request.addProperty("ID",x);

              //Declare the version of the SOAP request
              SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

              envelope.setOutputSoapObject(request);
              envelope.dotNet = true;

request body :

SendArray{NumberList=[Ljava.lang.String;@4052fa20; ID=[J@4052fb28; }

Error :

java.lang.RuntimeException: Cannot serialize: [Ljava.lang.String;@4052fa20

Solution

  • It can be possible..

    Try this link :) It is helpful to me too.

    Serialize an array of ints to send using KSOAP2