Android calls webservice to get special type of data

Due to the project requirements, there are the following code (which has been debugged, may not be able to run directly)
required jar download address: http://download.csdn.net/detail/lin358/9686785 (2016/11 latest version 3.6.2)

// method to call
            String methodName = "getWeather";

            //Create httpTransportSE transport object
            HttpTransportSE ht = new HttpTransportSE(SERVICE_URL);

            //Create an Envelop object using the soap1.1 protocol
            SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);

            //Instantiate the SoapObject object
            SoapObject request = new SoapObject(SERVICE_NS, methodName);

            //Setting parameters
            request.addProperty("theCityCode", "福州");
            request.addProperty("theUserID", "31121");

            //Set the SoapObject object to the outgoing SOAP message of the SoapSerializationEnvelope object
            envelope.bodyOut = request;
            envelope.dotNet = true;
            //envelope.addMapping(SERVICE_NS, "EqEntity", EqEntity.class);

            try{
                //call webService
                ht.call(SERVICE_NS + methodName, envelope);
                //txt1.setText("Look at"+envelope.getResponse());
                //t.setText("Start->");

                List<EqEntity> list = new ArrayList<EqEntity>();
                if(envelope.getResponse() != null){

                    //txt2.setText("There is a return");
                    SoapObject result = (SoapObject) envelope.bodyIn;
                    //Object result1 = envelope.getResponse();

                    String name = "";
                    SoapObject so = (SoapObject) result.getProperty(0);
                    for(int i = 0; i<so.getPropertyCount(); i++){
                        SoapObject object =  (SoapObject)so.getProperty(i);

//                        Field[] fields = object.getClass().getFields();
//                        for (int s = 0; s < fields.length; s++) {
//                            Field field = fields[s];
// field.setAccessible(true);//Ignore access permissions, private ones can also be accessed
//                            String a = field.get(object).toString();
//                        }
                        int count = object.getPropertyCount();
                        if(count==10){
                            //byte[] tt = StringToByte(object.getProperty(3).toString(), "UTF-8");

                            list.add(new EqEntity(object.getProperty(0).toString(),
                                    object.getProperty(1).toString(),
                                    object.getProperty(2).toString(),
                                    Base64.decode(object.getProperty(3).toString(), Base64.DEFAULT),
                                    object.getProperty(4).toString(),
                                    object.getProperty(5).toString(),
                                    object.getProperty(6).toString(),
                                    object.getProperty(7).toString(),
                                    object.getProperty(8).toString(),
                                    object.getProperty(9).toString()));
                        }
                        //EqEntity e = (EqEntity) oo;
                        //name += so.getProperty(i).toString()+"||";
                    //txt1.setText("Return value = "+name);
                }
                    //t.append("Return value = "+name);
                }else{
                   // t.append("No return");
                }

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326392067&siteId=291194637