我正在使用Soap WEb服务,但我遇到了一个像soap这样的问题:服务器'faultstring:'服务器无法处理请求。 --->位置0没有行。' faultactor:'null
我的代码是
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();
}
}
});
}
}
答案 0 :(得分:0)
应该是服务器返回的错误。如果可以,请从.net调用Web方法(或者如果您有web服务的localhost副本,则在浏览器中输入参数)。
今天早上我遇到了这个错误,然后我做了一个小的(5行).net应用程序来调用web方法。然后我得到了一个更清晰的错误信息。事实证明我的java代码一直没有问题。