Android soap Web服务传递带有对象类型的参数

时间:2016-05-27 12:57:56

标签: android web-services soap mapping ksoap2

网络服务: <soap:Body> <GetQueryStringLoginWithParameters xmlns="http://tempuri.org/"> <user>string</user> <password>string</password> <logonuser>string</logonuser> <parameters> <TopBarVisible>boolean</TopBarVisible> <LeftMenuVisible>boolean</LeftMenuVisible> <Action>string</Action> <ProcessFilter>string</ProcessFilter> <Parameters>string</Parameters> <DisableEBA3>boolean</DisableEBA3> <Mobile>boolean</Mobile> <DelegationFrom>string</DelegationFrom> <DelegationFromType>int</DelegationFromType> <Delegated>boolean</Delegated> <DelegationId>int</DelegationId> <SourceSystem>string</SourceSystem> <TestMode>boolean</TestMode> <ActivePosition>string</ActivePosition> </parameters> </GetQueryStringLoginWithParameters> </soap:Body>'

我想添加&#34; TopBarVisible&#34;,&#34; LeftBarVisible&#34;,&#34; Action&#34;等参数。但我没有。 Android代码:

`SoapObject request = new SoapObject(NAMESPACE,METHOD_NAME);

            QueryStringLoginParameters parameters = new QueryStringLoginParameters();
            parameters.setAction(action);
            parameters.setMobile(true);

            PropertyInfo pi = new PropertyInfo();
            pi.setName("parameters");
            pi.setValue(parameters);
            pi.setNamespace(NAMESPACE);
            pi.setType(parameters.getClass());
            request.addProperty(pi);
            request.addProperty("user", username);
            request.addProperty("password", password);
            request.addProperty("logonuser", logonuser);
            try {
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelope.dotNet = true;
            envelope.setOutputSoapObject(request);
            envelope.implicitTypes = true;
            envelope.addMapping(NAMESPACE,"parameters",new QueryStringLoginParameters().getClass());

            HttpTransportSE androidHttpTransportSE = new HttpTransportSE (URL);
            androidHttpTransportSE.debug = true;

            androidHttpTransportSE.call(SOAP_ACTION, envelope);
            SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
            String url = response.toString();
            Uri uri = Uri.parse(url);
            Intent intent = new Intent(Intent.ACTION_VIEW, uri);
            startActivity(intent);
            } catch (Exception e) {
                e.printStackTrace();`
            }
        }
        else
        {
        }

`

我收到错误&#34;无效的操作参数System.String []&#34;

0 个答案:

没有答案