Hi,
I'm no xfire developer so I'm not sure if I can be a part of this discussion. My thought is that you MUST have a multithreaded-capable client. What if an application makes several requests to a service? it could be even the same service? I can not afford to get an exception back. Also AXIS is multithreaded so it can deffinetly be done.
I'm using synchronous web service calls to an XFire web service (simple echo example) and I'm trying to create some load to see how it behaves, but my code throws exceptions all over.
Here is the stacktrace:
org.codehaus.xfire.XFireRuntimeException: Could not invoke service.. Nested exception is org.codehaus.xfire.fault.XFireFault: Unexpected character 'w' (code 119) in prolog; expected '<'
at [row,col {unknown-source}]: [1,129]
org.codehaus.xfire.fault.XFireFault: Unexpected character 'w' (code 119) in prolog; expected '<'
at [row,col {unknown-source}]: [1,129]
at org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
at org.codehaus.xfire.client.Client.onReceive(Client.java:467)
at org.codehaus.xfire.transport.http.HttpChannel.sendViaClient(HttpChannel.java:182)
at org.codehaus.xfire.transport.http.HttpChannel.send(HttpChannel.java:67)
at org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java:26)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:98)
at org.codehaus.xfire.client.Client.invoke(Client.java:360)
at org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
at $Proxy1.echo(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148)
at com.verizon.snm.performance.PerformanceInterceptor.invoke(PerformanceInterceptor.java:18)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176)
at $Proxy0.echo(Unknown Source)
at com.verizon.snm.echo.EchoServiceClientTest.performTest(EchoServiceClientTest.java:71)
at com.verizon.snm.echo.EchoServiceClientTest.run(EchoServiceClientTest.java:66)
at java.lang.Thread.run(Unknown Source)
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'w' (code 119) in prolog; expected '<'
at [row,col {unknown-source}]: [1,129]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:600)
at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1889)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1026)
at org.codehaus.xfire.soap.handler.ReadHeadersHandler.invoke(ReadHeadersHandler.java:44)
at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:98)
at org.codehaus.xfire.client.Client.onReceive(Client.java:450)
... 22 more
This exception happens when two (or more) threads invoke the line on Client.java:450 (version 1.1) at the same time.
recvContext.setInPipeline(inPipe);
inPipe.invoke(context);
MessageInfo msgInfo = exchange.getOperation().getOutputMessage();
In my humble user opinion, this is a must to be fixed.
My 2 cents.
Regards,
Andrés B.
Issue #1: Client is a one shot object, what I mean is, that it is neither thread safe nor multi-request capable if used asynchronously, because it wrappes the matching point for the response to the request. If you send several asynchrounos requests in a row, you'd need a fresh client for every request which leads to initialisation overhead.