我正在尝试使用ksop2将XML请求发送到Web服务
但这不是工作
我的网络服务请求格式是
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"> <Body> <UpdateVehicleViaObj xmlns="http://tempuri.org/"> <userHash>[string?]</userHash> <vehicleObject> <Colour xmlns="http://schemas.datacontract.org/2004/07/StockService">[string?]</Colour> <Comments xmlns="http://schemas.datacontract.org/2004/07/StockService">[string?]</Comments> <Condition xmlns="http://schemas.datacontract.org/2004/07/StockService">[string?]</Condition> </vehicleObject> </UpdateVehicleViaObj> </Body></Envelope>
我正在使用ksoap2创建请求
SoapObject request = new SoapObject("namespace", "methodname"); request.addProperty(properyObject); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11); //SOAP is implemented in dotNet true/false. envelope.dotNet = true; MarshalDouble md = new MarshalDouble(); //envelope.implicitTypes = true; envelope.implicitTypes = true; md.register(envelope); //Set request data into envelope and send request using httpTransport envelope.setoutputSoapObject(request); httpTransportSE androIDhttpTransport = new httpTransportSE(mInObj.getUrl(), networkTimeOut); androIDhttpTransport.deBUG= true; androIDhttpTransport.call(SoapAction, envelope,headerPropertyArrayList);
和ksop2使需求变得像这样
<v:Envelope xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:c="http://schemas.xmlsoap.org/soap/enCoding/" xmlns:v="http://schemas.xmlsoap.org/soap/envelope/"><v:header /><v:Body><UpdateVehicleViaObj xmlns="http://tempuri.org/" ID="o0" c:root="1"><userHash>B5B2FDF87E848946</userHash><vehicleObject><Colour>red</Colour><<Comments >red</Comments ><<Condition >red</Condition ><</vehicleObject></UpdateVehicleViaObj></v:Body></v:Envelope>
请帮忙..
解决方法:
查看ksoap2的文档
https://code.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks#sending/receiving_array_of_complex_types_or_primitives
您可以创建将实现marshable接口的类,并在该类中添加其他属性
总结以上是内存溢出为你收集整理的传递XML(DataSet)作为参数ksoap2 android全部内容,希望文章能够帮你解决传递XML(DataSet)作为参数ksoap2 android所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)