Passing string array to c# web service from Android

25 Mar

If you have below xml to parse

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="" xmlns:xsd="" xmlns:soap="">
    <Sample xmlns="">

Then use function below to call particular webservice by passing array object to it

public String Sample(){ 
        String SOAP_ACTION = "";
        String METHOD_NAME = "Sample";
//      URL =  "";   // to be adjusted to the URL above once this code is added into WebService;
        String IP_LIST="";
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); 
        List logs =  new ArrayList();
        SoapObject soapLogs = new SoapObject(NAMESPACE, "logs");
        for (String i : logs){
            soapLogs.addProperty("string", i);

        SoapSerializationEnvelope IPenvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        IPenvelope.dotNet = true;
        HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
            try {
      , IPenvelope);
                SoapPrimitive response = (SoapPrimitive)IPenvelope.getResponse();
                Log.i("myApp", response.toString());
                IP_LIST= response.toString();
            catch (Exception e) {
            return IP_LIST;
Leave a comment

Posted by on March 25, 2014 in Android Source Code


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: