Android program returns unexpected output

Basically what im trying to do is to return a object list from asp webservice and consume it from android.> My web service code is as follows: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; using System.Collections; namespace HelloWorldNew [WebService(Namespace = “http://sample.com/”)] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1…

via Android Application Development » Search Results » ajax:

Android program returns unexpected output

Basically what im trying to do is to return a object list from asp webservice and consume it from android.
> My web service code is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Collections;

namespace HelloWorldNew

[WebService(Namespace = “http://sample.com/”)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service1 : System.Web.Services.WebService

[WebMethod]
public List GetCustomerList(Vehicle obj)

//List newL = new List obj ;

return new List obj ;

}

[WebMethod]
public void simpleCase()

Vehicle obj = new Vehicle();
obj.VehicleID = “KL-9876″;
obj.VehicleType = “Nissan”;
obj.VehicleOwner = “Sanjiva”;
GetCustomerList(obj);

}

public class Vehicle

public string VehicleID get; set;
public string VehicleType get; set;
public string VehicleOwner get; set;
}
}> My Android code is as follows
package com.example.fp1_objectprocessing;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import org.ksoap2.*;
import org.ksoap2.serialization.SoapObject;
import org.ksoap2.serialization.SoapSerializationEnvelope;
import org.ksoap2.transport.*;

public class MainActivity extends Activity
TextView result;
Spinner spinnerC;

@Override
public void onCreate(Bundle savedInstanceState)
String[] toSpinnerSum;
toSpinnerSum = new String[9];

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
spinnerC = (Spinner) findViewById(R.id.spinner1);
result = (TextView) findViewById(R.id.textView2);

final String NAMESPACE = “http://sample.com/”;
final String METHOD_NAME = “GetCustomerList”;
final String SOAP_ACTION = “http://sample.com/GetCustomerList”;
final String URL = “http://myLocalIP/HelloWorldNew/Service1.asmx”;

SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
soapEnvelope.dotNet = true;
soapEnvelope.setOutputSoapObject(Request);
AndroidHttpTransport aht = new AndroidHttpTransport(URL);

try
aht.call(SOAP_ACTION, soapEnvelope);
SoapObject response = (SoapObject) soapEnvelope.bodyIn;
int intPropertyCount = response.getPropertyCount();

result.setText(response.toString());

catch (Exception e)

e.printStackTrace();

}
}> My Expected output
“KL-9876″
“Nissan”
“Sanjiva”> Program output
GetCustomerListResponseGetCustomerListResult=anyTypeVehicle=null; ; }I would like to know what changes i need to make in order to make this expected output happen. Thanks in advance.

For more info: Android program returns unexpected output

Android Application Development » Search Results » ajax

Android program returns unexpected output

Share this post:

Related Posts

Leave a Comment