public class main extends Activity {
/** Called when the activity is first created. */
private static String SOAP_ACTION = "http://footballpool.dataaccess.eu/data/TopGoalScorers";
private static String NAMESPACE = "http://footballpool.dataaccess.eu";
private static String METHOD_NAME = "TopGoalScorers";
private static String URL = "http://footballpool.dataaccess.eu/data/info.wso?WSDL";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request.addProperty("iTopN", 5);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.setOutputSoapObject(request);
// Make the soap call.
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
//AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport("http://www.google.co.in");
try {
// this is the actual part that will call the webservice
androidHttpTransport. call(SOAP_ACTION, envelope);
} catch (Exception e) {
e.printStackTrace();
Toast.makeText(this, e.toString(), Toast.LENGTH_LONG).show();
}
// Get the SoapResult from the envelope body.
SoapObject result = (SoapObject) envelope.bodyIn;
}
}
问问题
1020 次