how to Call ksoap web service from android?

吃可爱长大的小学妹 提交于 2019-12-01 19:55:46

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<PropertyInfo> 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;
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!