如何使用 WebService?这是我的代码:
WebServiceParams ws = new WebServiceParams(context);
SoapObject request = new SoapObject(ws.getWSNameSpace(), ws.getWSHelloMethod());
SoapSerializationEnvelope soapSerializationEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
soapSerializationEnvelope.setOutputSoapObject(request);
request.addProperty("name", "Charly");
try {
HttpTransportSE httpTransportSE = new HttpTransportSE(ws.getWSUrl());
httpTransportSE.debug = true;
httpTransportSE.call(ws.getWSNameSpace() + ws.getWSLoginMethod(), soapSerializationEnvelope);
String xmlResult = soapSerializationEnvelope.getResponse().toString();
return null;
} catch (Exception e) {
e.printStackTrace();
return e;
}
我得到了 soapFault faultcode soapClient faultstring Unmarshalling Error unexpected element uri:"", local:"name" expected elements are <{}request>
Web服务的主要部分是:
<request>
<name>?</name>
</request>
如何编写请求标签并在名称内发送它?