把 HttpTransportSE ht = new HttpTransportSE(URL); 换成AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
androidHttpTransport.call(NAMESPACE  + METHOD_NAME,envelope);
SoapObject result = (SoapObject) envelope.getResponse();

解决方案 »

  1.   

    给你个调java的:
    //创建SoapObject对象,指定WebService的命名空间和调用的方法名
    SoapObject request = new SoapObject(Utils.WS_NAME_SPACE, Utils.WSF_SET_PHONE_NUMBER);
    // 设置WebService方法的参数
    request.addProperty("phone", editPhone.getText().toString());
    // 创建SoapSerializationEnvelope对象,并指定WebService的版本
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    // 设置bodyOut属性
    envelope.bodyOut = request;
            try {
    // 创建HttpTransportSE对象,并指定WSDL文档的URL
    HttpTransportSE ht = new HttpTransportSE(Utils.WS_URL, Utils.WS_TIMEOUT);
    // 调用WebService
    ht.call(null, envelope);
    Object obj = envelope.getResponse();
    if (obj != null) {
    //使用getResponse方法获得WebService方法的返回结果
    SoapPrimitive soapPrimitive = (SoapPrimitive) envelope.getResponse();
                            wsResult = soapPrimitive.toString(); }
    } catch (Exception e) {
    isWsOver = true;
    return null;
    }
      

  2.   

    跟踪后发现,是对返回结果处理时出错,代码如下:
    txt = (TextView)findViewById(R.id.txt);
            String URL = "http://mysmser.zy.hhnw.com/service1.asmx?WSDL";
            String NAMESPACE = "http://tempuri.org/"; // targetNamespace  wsdl
            String METHOD_NAME = "HelloWorld"; 
            SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.bodyOut = request;
            AndroidHttpTransport androidHttpTransport = new AndroidHttpTransport(URL);
            try
            {
             androidHttpTransport.call(NAMESPACE  + METHOD_NAME,envelope);
            }
            catch(Exception e)
            {
             txt.setText("Call出错啦");
            }
            try
            {
             SoapObject result = (SoapObject) envelope.getResponse();
             try
             {
             if (result == null)
             txt.setText("返回的是空结果");
             else
             txt.setText(result.getProperty("string").toString());
             }
             catch (Exception e)
             {
             txt.setText("操作Result出错");
             }
            }
            catch (Exception e)
            {
             txt.setText("Resault 出错啦");
            }webservcie的返回结果是:<?xml version="1.0" encoding="utf-8" ?> 
      <string xmlns="http://tempuri.org/">something....</string> 
      

  3.   

    原来,是.net 返回的result是无法转换成SOAPObject的,只能是Object,搞定,但是,如果是返回多个内容咋办?试试在看吧