android - Ksoap 向后结果

标签 android soap ksoap

我有 ksop 请求。 我揉出来的是

<ns4:senddata>
        <connectionId xsi:type="xsd:string">
      asdfdsafdsfasdfdsa
        </connectionId> 
        <tws xsi:type="ns4:tws">
            <message xsi:type="xsd:string">
                this test message with a message id
            </message>
            <messageId>123</messageId>
            <num xsi:type="SOAP-ENC:Array" 
                     SOAP-ENC:arrayType="xsd:string[3]" 
                     SOAP-ENC:offset="[0]">
                <item xsi:type="xsd:string">977</item>
                <item xsi:type="xsd:string">496</item>
            </num>
        </tws>
    </ns4:senddata>

我得到的是

<senddata xmlns= WSDL_TARGET_NAMESPACE >
        <tws>
            <num>
                <item xsi:type="xsd:string">977</item>
                <item xsi:type="xsd:string">496</item>
            </num>
            <message i:type="d:string">
                this test message with a message id
            </message>
            <messageId>123</messageId>
        </tws>
        <connectionId xsi:type="d:string">
      asdfdsafdsfasdfdsa
        </connectionId> 
    </senddata>

如您所见,connectionID 位于底部而不是顶部。

private class smsSendRequest extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... urls) {
String reSultstr = null;
for (String url : urls) {
   SoapObject request = new SoapObject(WSDL_TARGET_NAMESPACE, url);
   request.addProperty("connectionId", did);

         SoapObject tws= new SoapObject("", "tws2");
     tws.addProperty("message", "message contents");
     tws.addProperty("messageId", "123");

       SoapObject num= new SoapObject("SOAP-ENC:Array", "mobiles");
    num.addProperty("item", "496");
          num.addProperty("item", "977");
          tws.addSoapObject(num);
    request.addSoapObject(tws);

      SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
   envelope.dotNet = true;
   envelope.setOutputSoapObject(request);
   HttpTransportSE httpTransport = new HttpTransportSE(SOAP_ADDRESS);
    try {
        httpTransport.debug = true;
        httpTransport.call(SOAP_ACTION, envelope);
                    SoapObject response = (SoapObject)envelope.getResponse();
                    reSultstr = response.getProperty(0).toString();
        } 
    catch (Exception exception){
       reSultstr = exception.toString();
       }
    }
    return reSultstr;
   }

我正在使用 Ksoap2 2.5.8 如果我切换到 2.6.* 它只是发送请求之前的 fatal error 。 有人能看出哪里出了问题吗? 我有另外两个 ksop 请求,一切都很好,但是这个请求有额外的 tws 节点,我相信问题是 ConnectionId 会先出现。

最佳答案

关于android - Ksoap 向后结果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9783399/

相关文章:

android - kSOAP2 双 ID 异常

android - SOAP和KSOAP之间的区别

android - Android中不同线程的数据库访问

java - 当我将“extends Activity”更改为“extends ListActivity”时,为什么会收到 "source not found"?

python - 我怎样才能 pickle 泡沫结果?

java - 适用于 Android 的 SOAP 客户端

Android - 如何向 ws 服务发送 double 值

安卓 : Error Snack bar not showing correctly with Map View

android - Android 中的基本测试 NavigationController

c++ - 我的应用程序(用 C 语言编写)每次调用时都会出现 gsoap 段错误