Hi folks,
Couldn't find any way to make this work via Google, hopefully there is
a way or I'm a bit shafted.
I'm working with services that send fairly large chunks of XML around,
and I'm currently testing the client. I have a mock service using the
Provider interface which just waits for a pre-set interval then
returns some XML.
However, when set the interval to greater than one minute and I invoke
it from a Dispatch object, I get this after 60 seconds:
javax.xml.ws.soap.SOAPFaultException: Could not send Message.
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:194)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:124)
at
info.cathdb.funcnet_0_1.impl.MockServiceTest.dispatch(MockServiceTest.java:100)
at
info.cathdb.funcnet_0_1.impl.MockServiceTest.testServiceReturnsAfterTwoMinuteDelay(MockServiceTest.java:93)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at
org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
at
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
at
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: 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:220)
at org.apache.cxf.jaxws.DispatchImpl.invoke(DispatchImpl.java:179)
... 27 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(SocketInputStream.java:129)
at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:687)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:632)
at
sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1002)
at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:373)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1937)
at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1865)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:593)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 29 more
I have the following entry in my cxf.xml, and I know it's being read
because I can cause errors by putting garbage in there:
<http:conduit id="Mock"
name="{http://cathdb.info/FuncNet_0_1/}MockPort.http-conduit">
<http:client ConnectionTimeout="600000" ReceiveTimeout="0" />
</http:conduit>
According to the docs, ReceiveTimeout=0 should give me an indefinite
wait, but it still bombs after a minute. I also tried setting it
explicitly to 600000 (ten minutes), same result.
I also tried this, having seen something like it on a blog post:
<http:conduit id="generic" name="*.http-conduit">
<http:client ConnectionTimeout="600000" ReceiveTimeout="0" />
</http:conduit>
No joy. Am I doing something obviously wrong here? I hope so because
otherwise I can't use Dispatch clients at all and will have to rewrite
half my codebase!
Ideally I'd like to set the timeout programmatically, rather than from
a config file, but I can't see anything in the JAX-WS API that lets
you get an equivalent of Client#getConduit() for Dispatch objects.
Any suggestions appreciated!
Thanks once again,
Andrew.
PS CXF version 2.1.2, but I couldn't find any JIRAs suggesting this
was an old fixed issue.