0

我正在创建可以使用肥皂客户端(WSDL)连接到 Web 服务的 android 应用程序。现在我想知道是否可以使用 PropertyInfo 创建请求并为其设置多个名称和值。我有此代码以获取有关我的问题的更多信息。

        String METHOD_NAME = "callLog";
        String NAMESPACE = "http://sasd.logpos.com/appservs/app/customize/qwe/ecq.wsdl/";
        String URL = "http://sasd.logpos.com/appservs/app/customize/qwe/ecqsoap.php";
        String SOAP_ACTION = "http://sasd.logpos.com/appservs/app/customize/qwe/ecq.wsdl/callLog";
        Log.i("myEmpId", myEmpId);
        Log.i("myPassword", myPassword);
        //create request
        SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
        //create param
        PropertyInfo paramsEmpId = new PropertyInfo();
        paramsEmpId.setName("authuserid");
        paramsEmpId.setValue(myEmpId);
        paramsEmpId.setType(String.class);


        paramsPass.setName("authpassword");
        paramsPass.setValue(myPassword);
        paramsPass.setType(String.class);
        request.addProperty(paramsEmpId, "LOGON");

        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);

        HttpTransportSE ht = new HttpTransportSE(URL);
        try {
            ht.call(SOAP_ACTION, envelope);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        }
        String response = null;
        try {
            response = envelope.getResponse().toString();
        } catch (SoapFault e) {
            e.printStackTrace();
        }
4

2 回答 2

0

是的,您可以添加尽可能多的PropertyInfo

我发现您正在使用它的另一个问题URL应该始终是一个WSDLurl 并检查您Namespace的。

//create param
        PropertyInfo paramsEmpId = new PropertyInfo();
        paramsEmpId.setName("authuserid");
        paramsEmpId.setValue(myEmpId);
        paramsEmpId.setType(String.class);

        PropertyInfo paramsPass= new PropertyInfo();// Create a new propertyInfo
        paramsPass.setName("authpassword");
        paramsPass.setValue(myPassword);
        paramsPass.setType(String.class);
        request.addProperty(paramsEmpId);// Changed here
        request.addProperty(paramsPass); // Changed here
于 2013-10-30T08:34:59.070 回答
0
       yes this possible and  hope this is going to help you

      please check the lines


 paramsPassInfo paramsPass= new paramsPassInfo();

        paramsPass.setName("authpassword");
        paramsPass.setValue(myPassword);
        paramsPass.setType(String.class);

  request.addProperty(paramsPass, "//name");
于 2013-10-30T08:35:48.073 回答