传递XML(数据集)作为参数ksoap2机器人 [英] Passing XML(DataSet) as Parameter ksoap2 android

查看:230
本文介绍了传递XML(数据集)作为参数ksoap2机器人的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图发送XML requst使用kso​​p2到web服务 但它不workig

i am trying to send XML requst to webservice using ksop2 but it is not workig

我的Web服务请求格式为:

my web service request format is

<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>

我使用kso​​ap2创建像

i am using ksoap2 to create request like

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变成了这个样子

and ksop2 make requst become like this

<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的文档

<一个href="https://$c$c.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks#sending/receiving_array_of_complex_types_or_primitives" rel="nofollow">https://$c$c.google.com/p/ksoap2-android/wiki/CodingTipsAndTricks#sending/receiving_array_of_complex_types_or_primitives

您可以创建将实现marshable接口,并添加类的内部其他财产类

you can create class that will implement marshable interface and add other property inside that class

这篇关于传递XML(数据集)作为参数ksoap2机器人的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆