我尝试使用SOAP Web服务失败了(我不知道这个WS背后是哪个架构,因为它是一个外部服务)。
我的代码是:
try{
_FakeX509TrustManager.allowAllSSL();
_FakeX509TrustManager trustM = new _FakeX509TrustManager();
trustM.isServerTrusted(null);
InetAddress address = InetAddress.getByName("mirservicetest.sanita.finanze.it");
Log.i(IMEDCERTIFICATI,address.toString());
androidTransport.call(SOAP_ACTION, envelope,headerPropertyList);
//androidTransport.call(SOAP_ACTION, envelope,headerPropertyList);
SoapObject response=(SoapObject)envelope.getResponse();
Log.i(IMEDCERTIFICATI,"Ho ricevuto qualcosa dal ws");
Log.i(IMEDCERTIFICATI,response.toString());
//response.getProperty(0);
}catch(Exception ex){
ex.printStackTrace();
}
我必须允许所有ssl证书,因为这是一个测试环境。 堆栈跟踪如下:
01-16 19:18:39.117: D/imedcertificati(14282): Full SSL active on new operating system version 15
01-16 19:18:39.128: W/System.err(14282): java.lang.NullPointerException
01-16 19:18:39.156: W/System.err(14282): at libcore.net.http.HttpConnection$Address.hashCode(HttpConnection.java:343)
01-16 19:18:39.156: W/System.err(14282): at java.util.HashMap.get(HashMap.java:298)
01-16 19:18:39.156: W/System.err(14282): at libcore.net.http.HttpConnectionPool.get(HttpConnectionPool.java:67)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpConnection.connect(HttpConnection.java:128)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpEngine.openSocketConnection(HttpEngine.java:308)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.makeSslConnection(HttpsURLConnectionImpl.java:460)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpsURLConnectionImpl$HttpsEngine.connect(HttpsURLConnectionImpl.java:432)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpEngine.sendSocketRequest(HttpEngine.java:282)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpEngine.sendRequest(HttpEngine.java:232)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpURLConnectionImpl.connect(HttpURLConnectionImpl.java:80)
01-16 19:18:39.160: W/System.err(14282): at libcore.net.http.HttpsURLConnectionImpl.connect(HttpsURLConnectionImpl.java:164)
01-16 19:18:39.160: W/System.err(14282): at it.senetech.iMedCertificati.utils.AndroidInsecureHttpsServiceConnectionSE.connect(AndroidInsecureHttpsServiceConnectionSE.java:117)
01-16 19:18:39.160: W/System.err(14282): at org.ksoap2.transport.HttpTransportSE.call(HttpTransportSE.java:152)
01-16 19:18:39.164: W/System.err(14282): at it.senetech.iMedCertificati.SendCertificato.onClick(SendCertificato.java:169)
01-16 19:18:39.164: W/System.err(14282): at android.view.View.performClick(View.java:3511)
01-16 19:18:39.164: W/System.err(14282): at android.view.View$PerformClick.run(View.java:14105)
01-16 19:18:39.164: W/System.err(14282): at android.os.Handler.handleCallback(Handler.java:605)
01-16 19:18:39.164: W/System.err(14282): at android.os.Handler.dispatchMessage(Handler.java:92)
01-16 19:18:39.164: W/System.err(14282): at android.os.Looper.loop(Looper.java:137)
01-16 19:18:39.168: W/System.err(14282): at android.app.ActivityThread.main(ActivityThread.java:4424)
01-16 19:18:39.168: W/System.err(14282): at java.lang.reflect.Method.invokeNative(Native Method)
01-16 19:18:39.168: W/System.err(14282): at java.lang.reflect.Method.invoke(Method.java:511)
01-16 19:18:39.168: W/System.err(14282): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
01-16 19:18:39.168: W/System.err(14282): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
01-16 19:18:39.168: W/System.err(14282): at dalvik.system.NativeStart.main(Native Method)
01-16 19:20:09.164: W/IInputConnectionWrapper(14282): showStatusIcon on inactive InputConnection
我试图尽可能让它变得可读。
提前感谢您的帮助,并为我糟糕的英语感到抱歉。
答案 0 :(得分:0)
好的,这是由错误的信封构造函数引起的。