このクラスを使用して Web サービスを呼び出してみてください。
public class WSRequest {
public HttpTransportSE androidHttpTransport;
public SoapSerializationEnvelope envelope;
public String methodName;
public SoapObject request;
public WSRequest(String methodName)
{
this.methodName = methodName;
this.request = new SoapObject(SRWebServer.NAMESPACE, methodName);
envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.implicitTypes = true;
envelope.dotNet = true;
envelope.setOutputSoapObject(request);
androidHttpTransport = new HttpTransportSE(SRWebServer.URL);
}
public void RegisterMarshal()
{
MarshalBase64 marshal = new MarshalBase64();
marshal.register(envelope);
}
public SoapObject Send() throws IOException, XmlPullParserException
{
System.setProperty("http.keepAlive", "false");
new MarshalDate().register(envelope);
this.androidHttpTransport.call(SRWebServer.NAMESPACE + this.methodName, envelope);
return (SoapObject) this.envelope.getResponse();
}
public void AddProperties(String name, Object value)
{
this.request.addProperty(name, value);
}
//
}
このように使用します:
WSRequest request = new WSRequest("method name here");
request.addProperties("property1Name",property1);
request.Send();
requestSend()
Web サービスから受け取ったオブジェクトを含む SoapObject を返します。