how to Call ksoap web service from android?

前端 未结 1 562
醉话见心
醉话见心 2021-01-18 21:13

I have a small confusion, in our mobile app an ksoap web service called from ios like below : and getting data properly. Here in the following web service you can see from f

1条回答
  •  清酒与你
    2021-01-18 21:28

    try Following Samples.

    1. ksoap-android-web-service-tutorial

    2. android-calling-a-web-service-using-ksoap2-passing-values-to-a-web-service

    Hope this will solve your problem

    I use the following method to call ksoap web-servie

    public String getServiceResponse(String nameSpace, String methodName,
            String soapAction, String Url, List mPropertyInfo) {
    
        String mResponse = "";
        SoapObject request = new SoapObject(nameSpace, methodName);
    
        SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
                SoapEnvelope.VER11);
        if (mPropertyInfo != null) {
            for (PropertyInfo propertyInfo : mPropertyInfo) {
                request.addProperty(propertyInfo);
            }
        }
        envelope.dotNet = true;
        envelope.setOutputSoapObject(request);
    
        HttpTransportSE ht = new HttpTransportSE(Url);
        ht.debug = true;
        try {
            ht.call(soapAction, envelope);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (XmlPullParserException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            mResponse = envelope.getResponse().toString();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return mResponse;
    }
    

    0 讨论(0)
提交回复
热议问题