使用Android连接到Delphi WebService

时间:2014-11-03 11:22:13

标签: android web-services delphi soap ksoap2

我在Delphi XE中编写了一个简单的Web服务 它在IIS上运行,如ISAPI Dll。

我无法通过Android连接到此网络服务:

private final String NAMESPACE = "http://217.114.221.83/grigliamo/";
private final String URL = "http://217.114.221.83/grigliamo/DifferenziaWS.dll/wsdl/IWSDifferenzia";
private final String SOAP_ACTION = "http://217.114.221.83/grigliamo/WS_Login";
private final String METHOD_NAME = "WS_Login";

public void getWebService(String x) {
    //Create request
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
            SoapEnvelope.VER11);
    envelope.setOutputSoapObject(request);
    HttpTransportSE androidHttpTransport = new HttpTransportSE(URL);

    try {
        //Involve web service
        androidHttpTransport.call(SOAP_ACTION, envelope);
        SoapPrimitive response = (SoapPrimitive) envelope.getResponse();
        Assign it to fahren static variable
        Res = response.toString();

    } catch (Exception e) {
        Res = e.toString();
        e.printStackTrace();
    }
}

我总是得到一个org.xmlpull.v1.XmlPullParserException:期待START_TAG 有人能告诉我我的网络服务有什么问题吗? 谢谢 安德烈

1 个答案:

答案 0 :(得分:0)

Web服务没有任何问题,SoapUI可以检索WSDL并发送登录请求。

我建议您阅读ksoap2 org.xmlpull.v1.xmlpullparserexception expected start_tag error

其中的答案包含为Web服务构建正确的SOAP请求参数/属性的分步指南。