0
SOAP Webサービスを呼び出すためにcxfクライアントを作成すると、connection refused
またはUnexpected end of file from server
が返されます。しかし、それはちょうど最初のリクエストで起こります。その後、クライアントが "ウォームアップ"して実際に動作するようです。CXF SOAPクライアントが最初の実行時に接続に失敗する
これはなぜ起こっているのですか?
if
-statementは、クライアントがすべての呼び出しだけではなく、最初に失敗する原因となる削除
...
if(port == null) {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.setAddress("http://localhost:9000/helloWorld");
port = factory.create(HelloWorld.class);
...
Client client= ClientProxy.getClient(port);
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
httpClientPolicy.setAllowChunking(false);
http.setClient(httpClientPolicy);
}
port.someMethod(); // fails on first run, but succeeds on all following runs
...
。私は本当に立ち往生し、どんな助けにも感謝します。