SOAPExceptionImpl:消息发送失败

时间:2017-11-01 15:36:50

标签: java xml web-services soap

尝试使用javax.xml.soap.SOAPConnection对象调用Soap Web服务时,我收到了java.lang.NullPointerException。

我确信endpointAddress和request参数是应该的(我已将它们打印出来)。堆栈跟踪如下:

    Caused by: java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at java.util.Properties.put(Properties.java:152)
at org.w3c.www.protocol.http.HttpManager.a(SourceFile:561)
at org.w3c.www.protocol.http.HttpManager.getManager(SourceFile:583)
at org.w3c.www.protocol.http.HttpManager.getManager(SourceFile:747)
at org.w3c.www.protocol.http.HttpURLConnection.checkRequest(SourceFile:108)
at org.w3c.www.protocol.http.HttpURLConnection.a(SourceFile:799)
at org.w3c.www.protocol.http.HttpURLConnection.setRequestProperty(SourceFile:778)
at com.sap.security.core.server.https.SecureConnectionFactory.createURLConnection(SecureConnectionFactory.java:999)
at com.sap.security.core.server.https.SecureConnectionFactory.createURLConnection(SecureConnectionFactory.java:891)
at com.sap.engine.httpdsrclient.protocols.https.Handler.openConnection(Handler.java:53)
at java.net.URL.openConnection(URL.java:965)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.createConnection(HttpSOAPConnection.java:669)
at com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:186)

此错误的尴尬部分是:如果我重新启动应用程序服务器,它会工作一段时间。它工作了一段时间(大约几个小时),然后它开始出现这个错误。

请帮我解决问题。

来源如下:

private SOAPMessage callService2(SOAPMessage request, String endpointAddress) throws Exception {
    SOAPConnection connection = null;
    try {
        System.setProperty("sun.net.client.defaultConnectTimeout","300000");
        System.setProperty("sun.rmi.transport.proxy.connectTimeout","300000");
        connection = SOAPConnectionFactory.newInstance().createConnection();
        URL endpointAddressURL = new URL(endpointAddress);
        return connection.call(request, endpointAddressURL);
    }
    catch (Exception e) {
        throw e;
    }
    finally {
        if(connection != null) {
            connection.close();
        }
    }
}

0 个答案:

没有答案