1

我正在使用 Soap WEB 服务,但我遇到了这样一个问题:soap:Server' faultstring: 'Server was unable to process request。---> 位置 0 处没有行。故障者:'空

我的代码是

public class GetData extends Activity {
    private static final String SOAP_ACTION="http://xxx.mobi/GetMobileContentMetaData";
    private static final String METHOD_NAME="GetMobileContentMetaData";
    private static final String NAMESPACE ="http://xxx.mobi/";
    private static final String URL = "http://webservices.xxx.mobi/MobileLMSServices.asmx";
    SoapObject request;
    Button submit;
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.getdata);   
        submit=(Button)findViewById(R.id.submit);
        submit.setOnClickListener(new OnClickListener() {

            @Override
            public void onClick(View v) {
                request = new SoapObject(NAMESPACE, METHOD_NAME);
                request.addProperty("SiteURL","http://heaklthcare.xxx.mobi/");
                request.addProperty("ContentID","62b90739-57b9-47cc-884a-8be2ef265304");
                request.addProperty("UserID",809);
                request.addProperty("DelivoryMode",2);
                SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
                envelope.dotNet = true;
                SoapObject result = null;
                envelope.setOutputSoapObject(request);
                AndroidHttpTransport sab = new AndroidHttpTransport(URL);
                sab.debug = true;
                try {
                    sab.call(SOAP_ACTION, envelope);
                    if (envelope.getResponse() != null) 
                    {
                        result = (SoapObject) envelope.bodyIn;
                        for (int i1 = 0; i1 < 1; i1++) {
                            Object property = result.getProperty(i1);
                            if (property instanceof SoapObject) {
                                SoapObject countryObj = (SoapObject) property;
                                Log.d("country" ,"object"+countryObj);
                            }
                        }
                    }
                }catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }
}
4

1 回答 1

0

应该是服务器返回的错误。如果可以,请从 .net 调用 Web 方法(或者如果您有 Web 服务的 localhost 副本,请在浏览器中输入参数)。

今天早上我遇到了这个错误,然后我做了一个小的(5 行).net 应用程序来调用 web 方法。然后我收到了更清晰的错误消息。也证明我的java代码一直没有问题。

于 2012-06-01T12:33:48.420 回答