使用kso​​ap2和wsdl android

时间:2013-09-15 23:16:35

标签: android wsdl ksoap2

我试着在我的代码中使用kso​​ap2库,但webservice不会返回任何内容,也不会在日志中显示任何错误。

我做错了什么?

这是我的代码的一部分。

private static final String SOAP_ACTION = "http://187.75.181.76:8090/RETORNASTK";
private static final String METHOD_NAME = "RETORNASTK";
private static final String NAMESPACE = "http://187.75.181.76:8090/";
private static final String URL = "http://187.75.181.76:8090/ws/WSAPPSTOCK.apw?WSDL";

      SoapObject Request = new SoapObject(NAMESPACE, METHOD_NAME);
      Request.addProperty("CUSRID","teste");
      Request.addProperty("CPASSID","teste");
      Request.addProperty("CUPC",result);

      SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

      soapEnvelope.setOutputSoapObject(Request);

      HttpTransportSE http_transport = new HttpTransportSE(URL);

      try {
          http_transport.call(SOAP_ACTION,soapEnvelope);

          SoapObject obj, obj1, obj2;
          obj = (SoapObject) soapEnvelope.getResponse();
          obj1 = (SoapObject) obj.getProperty("STRUCTSTK");

          for (int i = 0; i < obj1.getPropertyCount(); i++) { 
      // the method getPropertyCount() and  return the number of rows
                  obj2 = (SoapObject) obj1.getProperty(i);
                  obj2.getProperty(0).toString();// value of column 1
                  obj2.getProperty(1).toString();// value of column 2
                  // like that you will get value from each column
              }

      } catch (Exception e) {
          e.printStackTrace();
      } 

0 个答案:

没有答案