1

I need to pass a a string array to a predefined webserivce designed to accept an array of string values. However when I create a soap envelope and set array.class or string.class properties to the request it throws a serialization error.

Any suggestions for the above? What should be the suggested data type or method to work around the same.

 SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE,OPERATION_NAME);

    PropertyInfo p1 = new PropertyInfo();
    p1.setName("items");
    p1.setValue(results);
    p1.setType(String.class); // else Array.class.
    request.addProperty(p1);

    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    envelope.dotNet = true;

        HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
        httpTransport.debug = true;
        httpTransport.call(SOAP_ACTION, envelope);
                       // throws an error in the above.

        result = httpTransport.responseDump;
10
  • 1
    stackoverflow.com/questions/8518651/… Commented May 15, 2013 at 4:59
  • why you want to pass array? Commented May 15, 2013 at 5:36
  • 2
    Check out this example : oguzozkeroglu.com/… Commented May 15, 2013 at 6:04
  • @SagarMaiyad, what sort of a question is that? I want to because I have to. Commented May 15, 2013 at 6:17
  • @Raghunandan, thats the closest to what I was looking for, I could give you a useful upvote if you put the same in an answer, thank you! Commented May 15, 2013 at 6:20

2 Answers 2

2

It is a known issue with the KSOAP2 for Android library, which at the moment simply doesn't support arrays. The issue description is here.

A third-party patch, solution and an example can be found here.

Look on these link, You can find your answer on that.

Sign up to request clarification or add additional context in comments.

1 Comment

:need your help pls.refer this linkhttp://stackoverflow.com/questions/19198017/pass-arraylist-data-into-soap-web-service-in-android how can i pass arraylist data to SOAP service in android ?
0

Just pass parameter name and value like this in loop :

SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
HttpTransportSE ht = new HttpTransportSE(URL);
for (int i=0; i<itemId.length; i++){
    request.addProperty("itemID",itemId[i]);
}
ht.call(SOAP_ACTION, envelope);

Just pass parametername and item value in loop using request.addProperty

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.