1

这是我的 android 应用程序代码 PerformDownload.java 的一些片段

公共类 PerformDownload {

private final String NAMESPACE = "http://tempuri.org/";
private final String URL = "http://10.0.2.2:4304/Service1.asmx";

public String GetContacts(String username) throws IOException, XmlPullParserException
{
//  String result = null;

    final String SOAP_ACTION = "http://tempuri.org/GetContacts";
    final String METHOD_NAME = "GetContacts";

    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);

request.addProperty("用户名",用户名);

    SoapSerializationEnvelope envelope = new          SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = true; // put this only if the web service is .NET one
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    androidHttpTransport.call(SOAP_ACTION, envelope);
    KvmSerializable response=   (KvmSerializable)envelope.bodyIn;

我在 SoapObject,SoapSerializationEnvelope(SoapEnvelope.VER11) 上遇到错误;等等。为什么上面的代码没有访问soap协议。

4

0 回答 0