How to pass parameter to a webservice using ksoap2?

前端 未结 6 1648
后悔当初
后悔当初 2020-12-16 17:28

I\'m using Eclipse IDE to develop an android app. I\'m trying to connect to a .net webservice. I\'m using ksoap2 version 2.3

When I\'m calling a webmethod with no

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-16 17:57

    In here Problem With the Order of Codes You Wrote, Don't Worry Try this, It's Worked for me.

    private class ConversionAsyncTask extends AsyncTask {
        private SoapPrimitive response;
        protected Void doInBackground(Void... params) {
    
            SoapObject request = new SoapObject(NAMESPACE, METHOD);
    
    
            request.addProperty("a","5");
            SoapSerializationEnvelope soapEnvelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
            soapEnvelope.setOutputSoapObject(request);
    
            soapEnvelope.dotNet = true;
            soapEnvelope.implicitTypes = true;
    
            try {
                HttpTransportSE aht = new HttpTransportSE(URL);
                aht.call(SOAP_ACTION, soapEnvelope);
    
                response = (SoapPrimitive) soapEnvelope.getResponse();
    
            } catch (Exception e) {
                e.printStackTrace();
            }
            return null;
        }
    
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
            temperatureTxt.setText("Status: " + response);
        }
    }
    

提交回复
热议问题