0
我正在嘗試使用Android調用echelon smartserver的Web服務。 我需要替換與Android不兼容的jax-ws。我決定使用KSOAP2。KSOAP2 webservice ilon100 smartserver
我想這樣,但沒有成功:
public class ConnectTest extends Activity implements OnClickListener {
Button SoapButton;
private static final String NAMESPACE = "http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/wsdl/";
private static String URL = "http://192.168.100.247/WSDL/v4.0/iLON100.wsdl";
private static final String METHOD_NAME = "List";
private static final String SOAP_ACTION = "http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/wsdl/List";
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
PropertyInfo propInfo = new PropertyInfo();
propInfo.name = "iLonItem";
request.addProperty("<xSelect>//Item[@xsi:type=\"Item_Cfg\"]</xSelect>",propInfo);
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);
try
{
androidHttpTransport.call(SOAP_ACTION, envelope);
SoapPrimitive resultsRequestSOAP = (SoapPrimitive) envelope
.getResponse();
SoapResponse = resultsRequestSOAP.toString();
System.out.println("SOAP" + SoapResponse);
} catch (Exception e)
{
Log.e("Error", "pb IO", e);
SoapResponse = "error connection";
}
return SoapResponse;
它結束了以下控制檯錯誤:
java.lang.RuntimeException: Cannot serialize: iLonItem : (not set)
我應該怎麼做來糾正使用SOAP發送下面的消息?當然使用KSOAP2。
<List xmlns="http://wsdl.echelon.com/web_services_ns/ilon100/v4.0/message/">
<iLonItem>
<xSelect>//Item[@xsi:type=\"Item_Cfg\"]</xSelect>
</iLonItem>
</List>
請幫忙。 謝謝!
不幸的是同樣的錯誤... –
你知道請求結構是什麼嗎?它應該看起來像我上面提到的 – user3331142
我想發送的消息(在我的第一篇文章的底部)是來自服務器製造商給出的程序員參考指南的一個例子 –