Android 如何在soapweb服务中发布数据
我有以下XML,我想在ProductNumber、Quantity、Price中发布记录Android 如何在soapweb服务中发布数据,android,web-services,ksoap2,Android,Web Services,Ksoap2,我有以下XML,我想在ProductNumber、Quantity、Price中发布记录 <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<QueryPrices xmlns="xyz">
<strSessionKey>string</strSessionKey>
<nDiscountID>int</nDiscountID>
<objOrderItems>
<OrderItem>
<ProductNumber>int</ProductNumber>
<Quantity>int</Quantity>
<Price>float</Price>
</OrderItem>
<OrderItem>
<ProductNumber>int</ProductNumber>
<Quantity>int</Quantity>
<Price>float</Price>
</OrderItem>
</objOrderItems>
</QueryPrices>
</soap:Body>
</soap:Envelope>
一串
int
int
int
浮动
int
int
浮动
创建Soap对象,只需使用addProperty()
传递参数
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
request .addProperty("key", value);
处理
就你而言:
request.addProperty( "ProductNumber","something");
request.addProperty( "Quantity","something");
request.addProperty( "Price","something");
根据你的回答,我已经发布了stressionkey和nDiscountID。但我想在ProductNumber、ProductNumber、Quantity和Price中输入值。它位于objOrderItems标记中。在使用此代码w/System.err(1411)后,我遇到以下异常:SoapFault-faultcode:'soap:Server'faultstring:'服务器无法处理请求。-->对象引用未设置为对象的实例。“faultactor:“null”详细信息:org.kxml2.kdom。Node@44f75908