KSOAP2 android 对名称空间感到困惑 / url 和 HttpTransportSE 的 call() 函数抛出 EOF 异常

KSOAP2 android confused about namespaces / url and HttpTransportSE's call() function throws EOF-Exception

我无法弄清楚为什么我在 Android 上的 soap 请求不起作用,我遵循了 https://code.tutsplus.com/tutorials/consuming-web-services-with-ksoap--mobile-21242

上的教程

这基本上是我的代码如下:

public class SoapClient {

private static final String NAMESPACE = "https://ieslamp.technikum-wien.at/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php";

//not used right now
private static final String TARGET_NAMESPACE = "http://ieslamp.technikum-wien.at/soap/getJamRoutes";
private static final String SOAP_ACTION = "https://ieslamp.technikum-wien.at/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php/getJamRoutes";
//which is the URL I need? some tutorials say it's the url to the wsdl, but others say it's the location of the webservice
private static final String POST_URL = "https://ieslamp.technikum-wien.at/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php?wsdl";
private static final String LOCATION_URL = "https://ieslamp.technikum-wien.at:443/sys_bvu4_17_l/JamDec/ContentManager/soapservice.php";

private Context context;

public SoapClient(Context context) {
    this.context = context;
}

public String getJamsFromServer() {


    String methodname = "getJamRoutes";
    SoapObject request = new SoapObject(TARGET_NAMESPACE, methodname);
    String routes = null;

    SoapSerializationEnvelope envelope = getSoapSerializationEnvelope(request);

    HttpTransportSE ht = getHttpTransportSE();
    try {
        ArrayList<HeaderProperty> headerPropertyArrayList = new ArrayList<>();
        headerPropertyArrayList.add(new HeaderProperty("Connection", "close"));
        ht.call(SOAP_ACTION, envelope, headerPropertyArrayList);
        SoapPrimitive result = (SoapPrimitive)envelope.getResponse();
         routes = result.toString();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (XmlPullParserException e) {
        e.printStackTrace();
    }
    return routes;
}


private final SoapSerializationEnvelope getSoapSerializationEnvelope(SoapObject request) {
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet = false;
    envelope.implicitTypes = true;
    envelope.setOutputSoapObject(request);

    return envelope;
}

private final HttpTransportSE getHttpTransportSE() {
    HttpTransportSE ht = new HttpTransportSE(Proxy.NO_PROXY, LOCATION_URL, 1200000);
    ht.debug = true;

    ht.setXmlVersionTag("<!--?xml version=\"1.0\" encoding= \"UTF-8\" ?-->");
    return ht;
}

}

服务 returns 一个 "Hello World" - 字符串,我正在使用 SOAP-UI 对其进行测试,使用该软件的请求实际上会给我一个响应,但是当我我正在尝试用我的 Android 应用做出回应 -

ht.call();

向我抛出一个 EOF 异常,我不知道出了什么问题。

您能否解释一下哪个命名空间和 url 用于 -

HttpTransportSE ht = new HttpTransportSE(URL); 

我究竟需要什么?我是使用 targetNamespace 还是 Namespace?研究的时候想不通

这是我生成的 wsdl 文件:

感谢您的帮助!

问题自行解决,好像是最新的jar文件不起作用。如果您打算使用 ksoap,我建议您使用标记为已弃用的旧版本,但它们至少可以完成这项工作。