SoapObject Result returns anyType{} as value when retuning a complexType object

后端 未结 4 2103
太阳男子
太阳男子 2021-02-06 10:58

I am calling a web service in my android app & the method is getGramaNiladhariData(), I am getting the result as a SoapObject.

result = (SoapObject) envelope.         


        
4条回答
  •  长发绾君心
    2021-02-06 11:18

    I've had this problem before. And I solved it. I've had this problem before. And I solved it. I seemed to spend a lot of time to find a solution to this problem. My Project it's work. I create Web Service .Net Object Array. I hope this will help you.

            //.................................
            SoapObject requestx = new SoapObject(NAMESPACE, METHOD_NAME);
    
            SoapSerializationEnvelope envelopex = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            envelopex.dotNet = true;
            envelopex.setOutputSoapObject(requestx);
            HttpTransportSE httpTransportx = new HttpTransportSE(URL);          
    
            try  {                    
                httpTransportx.call(SOAP_ACTION, envelopex);
                SoapObject responsex = (SoapObject)envelopex.getResponse(); // not envelopex.bodyIn;
    
                 int i=0;
                 int RCount=responsex.getPropertyCount();
                 int[] tbIDArray = new int[RCount+1];
                 int[] iMonthAarray = new int[RCount+1];
                 int[] iYearAarray = new int[RCount+1];
                 String[] sDetailAarray = new String[RCount+1];
    
                 for (i = 0; i < RCount; i++) {
                     Object property = responsex.getProperty(i);
                     if (property instanceof SoapObject) {
                         SoapObject info = (SoapObject) property;
                         String tbID = info.getProperty("tbID").toString();
                         String iMonth = info.getProperty("iMonth").toString();
                         String iYear = info.getProperty("iYear").toString();
                         String sDetail = info.getProperty("sDetail").toString();
    
                        tbIDArray[i] =Integer.valueOf(tbID);
                        iMonthAarray[i] =Integer.valueOf(iMonth);
                        iYearAarray[i] =Integer.valueOf(iYear);
                        sDetailAarray[i] =sDetail;
                     }//if (property instanceof SoapObject) {
                 }//for (i = 0; i < RCount; i++) {
    
    
            }  catch (Exception exception)   {
                MsgBox1(exception.toString() , "Error");
            }
    

提交回复
热议问题