I am trying to run the following test (am using openejb)
public void testCalculatorViaWsInterface() throws Exception {
Service calcService = Service.create(new URL("
http://127.0.0.1:4204/CalculatorImpl?wsdl"), null);
assertNotNull(calcService);
CalculatorWs calc = calcService.getPort(CalculatorWs.class);
// Get the CXF Client. We will use it to enable logging and
set the
client policy to disallow chunking.
org.apache.cxf.endpoint.Client client =
org.apache.cxf.frontend.ClientProxy.getClient(calc);
// Logging CXF -- uncomment the next two lines to enable logging
of SOAP
requests and responses.
client.getInInterceptors().add(new LoggingInInterceptor());
client.getOutInterceptors().add(new LoggingOutInterceptor());
assertEquals(10, calc.sum(4,6));
assertEquals(12, calc.multiply(3,4));
}
When I try to run the above test, sometimes I get the following
exception:-
Jul 3, 2008 11:06:51 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service {http://superbiz.org/
wsdl}CalculatorWsService<http://superbiz.org/wsdl%7DCalculatorWsService
>from WSDL:
http://127.0.0.1:4204/CalculatorImpl?wsdl
Jul 3, 2008 11:07:51 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
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:
208)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:276)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:222)
at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:
135)
at $Proxy17.multiply(Unknown Source)
at
org
.superbiz
.calculator
.CalculatorTest.testCalculatorViaWsInterface(CalculatorTest.java:53)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at
org
.junit
.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:35)
at
org
.apache
.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite
.executeTestSet(AbstractDirectoryTestSuite.java:140)
at
org
.apache
.maven
.surefire
.suite
.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
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:585)
at
org
.apache
.maven
.surefire
.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:338)
at
org
.apache
.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:997)
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:256)
at java.io.BufferedInputStream.read(BufferedInputStream.java:313)
at sun.net.www.http.HttpClient.parseHTTPHeader(HttpClient.java:
681)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:626)
at sun.net.www.http.HttpClient.parseHTTP(HttpClient.java:646)
at
sun
.net
.www
.protocol
.http.HttpURLConnection.getInputStream(HttpURLConnection.java:957)
at
java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:
367)
at
org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.handleResponse(HTTPConduit.java:1863)
at
org.apache.cxf.transport.http.HTTPConduit
$WrappedOutputStream.close(HTTPConduit.java:1791)
at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:
66)
at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:575)
at
org.apache.cxf.interceptor.MessageSenderInterceptor
$
MessageSenderEndingInterceptor
.handleMessage(MessageSenderInterceptor.java:62)
... 30 more
Jul 3, 2008 11:07:51 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.binding.soap.SoapFault: Error reading XMLStreamReader.
at
org
.apache
.cxf
.binding
.soap
.interceptor
.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:
191)
at
org
.apache
.cxf
.binding
.soap
.interceptor
.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:56)
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:
208)
at
org
.apache
.cxf
.transport
.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:77)
at
org
.apache
.openejb.server.cxf.HttpDestination.invoke(HttpDestination.java:111)
at
org
.apache
.openejb.server.cxf.CxfWsContainer.processPOST(CxfWsContainer.java:
114)
at
org
.apache
.openejb.server.cxf.CxfWsContainer.onMessage(CxfWsContainer.java:85)
at
org.apache.openejb.server.webservices.OpenEJBHttpWsRegistry
$ClassLoaderHttpListener.onMessage(OpenEJBHttpWsRegistry.java:113)
at
org
.apache
.openejb
.server
.httpd.HttpListenerRegistry.onMessage(HttpListenerRegistry.java:43)
at
org
.apache
.openejb
.server.httpd.OpenEJBHttpServer.process(OpenEJBHttpServer.java:176)
at
org
.apache
.openejb
.server
.httpd.OpenEJBHttpServer.processRequest(OpenEJBHttpServer.java:132)
at
org
.apache
.openejb
.server.httpd.OpenEJBHttpServer.service(OpenEJBHttpServer.java:78)
at
org
.apache
.openejb.server.httpd.HttpEjbServer.service(HttpEjbServer.java:61)
at org.apache.openejb.server.ServicePool$2.run(ServicePool.java:
78)
at org.apache.openejb.server.ServicePool$3.run(ServicePool.java:
101)
at
java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:650)
at
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:675)
at java.lang.Thread.run(Thread.java:595)
Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF in
prolog
at [row,col {unknown-source}]: [1,0]
at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:
661)
at
com.ctc.wstx.sr.BasicStreamReader.handleEOF(BasicStreamReader.java:
2134)
at
com
.ctc
.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:
2040)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:
1069)
at
com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:
1095)
at
org
.apache
.cxf
.binding
.soap
.interceptor
.ReadHeadersInterceptor.handleMessage(ReadHeadersInterceptor.java:85)
... 17 more
--
Karan Singh Malhi