android - KSoap 和 HttpsTransportSE 返回 URISyntaxException(格式错误的 IPV6 地址)?

标签 android exception https ksoap

我试图在 Ksoap 中使用 HttpsTransportSE,但我收到 URISyntaxException,说我有一个格式错误的 IPV6 地址 - 我想这是有道理的,因为我正在传递一个 URL...但我该如何修复它?

我找到了一个类似的查询 here但这涉及到 Http 而不是 Https 类,我没有描述的重载方法。

我是 SOAP 的新手,但到目前为止我的代码是这样的:

    String SOAP_ACTION = "http://url.to.thingy";
String METHOD_NAME = "methodNameFromAsmx";
String NAMESPACE = "http://the.namespace";
String URL = ServerName;
    SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME);
    request.addProperty("Address", UserName);
    SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
    envelope.dotNet=true;
    envelope.setOutputSoapObject(request);
    HttpsTransportSE androidHttpTransport = new HttpsTransportSE(URL, 443, "/relative/pathToAsmx", 5000);
    androidHttpTransport.call(SOAP_ACTION, envelope);

我现在已经用 fudge 替换了各种属性,因为我希望它不相关。我的错误显示格式错误的 IPV6 为:https:%2F%2Fmy.url.com

最佳答案

使用这种格式,

private static final String NAMESPACE = "http://tempuri.org/";
private static final String URL = "192.168.30.8";
private static final String SERVICE = "/Wcf.WCF_.svc?wsdl";
private static String SOAP_ACTION = "http://tempuri.org/iWCF/";

关于android - KSoap 和 HttpsTransportSE 返回 URISyntaxException(格式错误的 IPV6 地址)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9077003/

相关文章:

android - 将 firebase 库更新到 16.0.0 会引发 google play 服务依赖性问题

java - 如何水平添加TextView?

mysql - SonarQube 无法插入 MySql 数据库

docker - 无法访问 ASP.NET Core Docker 容器应用程序

delphi - 如何通过 https 使用 IdHTTP 下载有进度的文件

java - 如何在Android Studio中从java中的另一个文件导入类?

java - OnActivityResult 没有被调用

HTTP 请求和 TCP 连接

c++ - 异常允许我们分离什么?

Java:从文件读取时扫描仪不接受 try-catch 类错误