0
如何才能使用WebService?這是我的代碼:Web服務Android肥皂
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解組錯誤意想不到的元素URI:「」本地「名」預期的元素是< {}請求>
的主要部分webservice是:
<request>
<name>?</name>
</request>
我該如何寫請求標記並在名稱內部發送它?
這裏真正的問題是如何通過webservice發送POJO? – user1893074
您可以嘗試使用Gson將pojo序列化爲JSON。 – blindado