【发布时间】:2014-12-19 09:27:42
【问题描述】:
如何在 Android 的 wsdl Web 服务中找到 SOAP_NAMESPACE、SOAP_ACTION、SOAP_METHOD_NAME
我的网络服务如下:
http://demo.ecount.in/eService.svc?wsdl
如果有人知道,请帮助我。
谢谢。
我的代码如下:
public final static String URL = "http://demo.ecount.in/eService.svc?wsdl";
public static final String NAMESPACE = "http://tempuri.org/";
public static final String SOAP_ACTION_PREFIX = "urn:eService/ExcuteDataSet1";
private static final String METHOD = "ExcuteDataSet1";
private String resp;
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
SoapObject request = new SoapObject(NAMESPACE, METHOD);
//bodyOut is the body object to be sent out with this envelope
envelope.bodyOut = request;
HttpTransportSE transport = new HttpTransportSE(URL);
try {
transport.call(NAMESPACE + SOAP_ACTION_PREFIX + METHOD, envelope);
} catch (IOException e) {
e.printStackTrace();
Log.e("Error", e.toString());
} catch (XmlPullParserException e) {
e.printStackTrace();
Log.e("Error XmlPullParserException", e.toString());
}
//bodyIn is the body object received with this envelope
if (envelope.bodyIn != null) {
//getProperty() Returns a specific property at a certain index.
SoapPrimitive resultSOAP = (SoapPrimitive) ((SoapObject) envelope.bodyIn)
.getProperty(0);
resp=resultSOAP.toString();
}
它给出错误:“HTTP 请求失败,HTTP 状态:500”
【问题讨论】: