3
我需要通过HTTPS使用javax.xml.soap为SOAP调用设置超时 但是,我不知道该怎么做,必须有一个技巧来做到这一点但我找不到它。如何为SOAP调用设置超时
SOAPMessage sm = null;
SOAPMessage response = null;
SOAPConnectionFactory sfc = SOAPConnectionFactory.newInstance();
SOAPConnection connection = sfc.createConnection();
MessageFactory mf = MessageFactory.newInstance();
sm = mf.createMessage();
...
...
URL url = new URL("https://server:XXXX/blablabla);
response = connection.call(sm, url);
我看到有人这样做:
if (xxxSoapService instanceof Stub)
((Stub) xxxSoapService).setTimeout(10000);
xxxSoapService扩展java.rmi.Remote和存根上进口org.apache.axis.client.Stub;
有可能是我在那里失踪的东西。
我怎样才能得到答案?像以前一样,我在做SOAPMessage response = connection.call(sm,server);我需要检查错误的响应 – user393381
使用connection.getInputStream()。这应该给你答复的主体。要获取标题,有几个方法:getHeaderField(),getHeaderFieldKey()。检查HttpURLConnection文档以获取更多详细信息。 – George