A bit more information. I tried another experiment, calling a different service on the same host/port, and it demonstrates similar beaviour.
Thanks David Corbin On Fri, Aug 23, 2013 at 8:13 AM, David Corbin <[email protected]> wrote: > I have written a SOAP client using CXF for several third-party SOAP > services. I generated java code from the wsdl using wsdl2java. The system > works, but it's inefficient (I'm creating a new proxy for every call), so I > thought I'd pool proxy objects. That's when I first noticed the problem. > > After extensive experimentation and hacking, I've found that if I attempt > to call a service twice with only a short delay, it consistently fails with > an exception (see below). The "short delay" appears to almost 5 seconds. > If I put a 5-second delay in between re-uses, I can call it repeatedly > without any problems. Now, I know this sounds crazy, but I've boiled it > down to pretty simple code. At first I thought it was about re-use of a > proxy. But further investigation has shown I have the same problem calling > different methods on the same service, and it happens if I have one proxy > or two. > > I am starting to suspect a server-side problem, but it could be how I'm > creating the proxy. > > So, in my mind, there's either a shared, stateful object (possibly a > socket/connection) that multiple proxies use that has a problem, or it's a > problem strictly on the server side. If it's the former, I'd appreciate > help in changing my proxy creation technique. If it's the latter, I'd like > to really be able to *prove* that it's caused by bad server side behaviour. > > Any help appreciated. > Thanks > > David Corbin > > > ---exception--- > > org.apache.cxf.interceptor.Fault: Could not send Message. > at > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64) > at > org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:271) > at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366) > at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319) > at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) > at > org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:133) > at com.sun.proxy.$Proxy46.login(Unknown Source) > at SimpleCxfCheck.login(SimpleCxfCheck.java:39) > at SimpleCxfCheck.testLoadApplicationContext(SimpleCxfCheck.java:23) > at SimpleCxfCheck.main(SimpleCxfCheck.java:10) > Caused by: java.net.SocketException: SocketException invoking > http://somehost.zcorum.com:8996/axis2/services/IncEntitySecurityService: > Unexpected end of file from server > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:526) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1338) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1322) > at > org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56) > at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:622) > at > org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62) > ... 11 more > Caused by: java.net.SocketException: Unexpected end of file from server > at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:718) > at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:579) > at > sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1322) > at > java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468) > at > org.apache.cxf.transport.http.URLConnectionHTTPConduit$URLConnectionWrappedOutputStream.getResponseCode(URLConnectionHTTPConduit.java:260) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1517) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1490) > at > org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1309) > ... 14 more > > ---end---- > > ---begin code sample--- > > import org.apache.cxf.jaxws.JaxWsProxyFactoryBean; > > import com.incognito.bcc.incentitysecurity.IncEntitySecurityPortType; > import com.incognito.bcc.incentitysecurity.Login; > import com.incognito.bcc.incentitysecurity.LoginResponse; > > > public class SimpleCxfCheck { > public static void main(final String[] args) { > new SimpleCxfCheck().run(); > } > private static final String URL = > "http://somehost.zcorum.com:8996/axis2/services/IncEntitySecurityService"; > > public void run() { > System.setProperty("org.apache.cxf.stax.allowInsecureParser", "1"); > final JaxWsProxyFactoryBean factoryBean = new JaxWsProxyFactoryBean(); > factoryBean.setServiceClass(IncEntitySecurityPortType.class); > factoryBean.setAddress(URL); > > final IncEntitySecurityPortType portType = > (IncEntitySecurityPortType) factoryBean.create(); > > System.out.println(login(portType, "zcuser", "password")); > sleep(5000); > System.out.println(login(portType, "zcuser", "password")); > } > > private void sleep(final int milliSeconds) { > try { > Thread.sleep(milliSeconds); > } catch (final InterruptedException e) { > throw new RuntimeException("FIX ME", e); > } > } > > private String login(final IncEntitySecurityPortType portType, final > String loginName, final String password) { > final Login parameters = new Login(); > parameters.setLoginName(loginName); > parameters.setPassword(password); > > final LoginResponse loginResponse = portType.login(parameters); > return loginResponse.getAuthorizationToken().getToken(); > } > } > > > ---end code sample--- >
