是否可以在soap中交换xml代码行

时间:2012-03-23 00:14:50

标签: android web-services soap ksoap

我希望发送一个像

这样的请求
<v:Envelope xmlns:i="xxx">
 <v:Header />
 <v:Body>
  <sendTwoWaySmsMessage xmlns="xxx" id="o0" c:root="1">
   <connectionId i:type="d:string">connectionId</connectionId>
   <twoWaySmsMessage>
    <message i:type="d:string">love it. It seems to work</message>
    <mobiles i:type="d:string">345</mobiles>
    <messageId i:type="d:string">123</messageId>
   </twoWaySmsMessage>
   </sendTwoWaySmsMessage>
  </v:Body>
</v:Envelope>

我得到的是

<v:Envelope xmlns:i="xxx">
 <v:Header />
 <v:Body>
  <sendTwoWaySmsMessage xmlns="xxx" id="o0" c:root="1">
   <twoWaySmsMessage>
    <message i:type="d:string">love it. It seems to work</message>
    <mobiles i:type="d:string">345</mobiles>
    <messageId i:type="d:string">123</messageId>
   </twoWaySmsMessage>
   <connectionId i:type="d:string">connectionId</connectionId>
   </sendTwoWaySmsMessage>
  </v:Body>
 </v:Envelope>

代码是

SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, url);
SoapObject message = new SoapObject("", "twoWaySmsMessage");
request.addProperty("connectionId", did);

message.addProperty("message", "love it. It seems to work");
message.addProperty("mobiles", "435");
message.addProperty("messageId", "123");

request.addSoapObject(message);
request.setProperty(0, "connectionId");

当我使用SoapUI与第二个“connectionId”swdped似乎工作可以任何人帮助。有想法。 我已经查看了几乎每个ksoap问题,似乎无法找到答案?

2 个答案:

答案 0 :(得分:0)

尝试更改:

request.addSoapObject(message);
request.setProperty(0, "connectionId");

为:

request.setProperty(0, "connectionId");
request.addSoapObject(message);

答案 1 :(得分:0)

这结果是一个问题。

http://code.google.com/p/ksoap2-android/issues/detail?id=113

期待结果。