gpt4 book ai didi

android - 传递 XML(DataSet) 作为参数 ksoap2 android

转载 作者:数据小太阳 更新时间:2023-10-29 02:29:54 28 4
gpt4 key购买 nike

我正在尝试使用 ksop2 将 XML 请求发送到网络服务但它不起作用

我的网络服务请求格式是

<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让requst变成这样

<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>&lt;Colour&gt;red&lt;/Colour&gt;&lt;
&lt;Comments &gt;red&lt;/Comments &gt;&lt;&lt;Condition &gt;red&lt;/Condition &gt;&lt;</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 接口(interface)的类并在该类中添加其他属性

关于android - 传递 XML(DataSet) 作为参数 ksoap2 android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27164419/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com