<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    XTS tests broken in AS trunk after switch to CXF stack in 3.3.0
</h3>
<span style="margin-bottom: 10px;">
    reply from <a href="http://community.jboss.org/people/adinn">Andrew Dinn</a> in <i>JBoss Web Services CXF</i> - <a href="http://community.jboss.org/message/547157#547157">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><blockquote class="jive-quote"><p>Andrew Dinn wrote:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>. . .</p>Now this is rather weird because the message with action <a class="jive-link-external-small" href="http://fabrikam123.com/InitiatorPortType/Response" target="_blank">http://fabrikam123.com/InitiatorPortType/Response</a> is never sent to the Participant service implemented by class ParticipantPortTypeImpl. Not surprisingly given the action definition it is sent to service Initiator implemented by class InitiatorPortTypeImpl. So, mmy code is sending messages to one service and they are being delivered to another service. Of course when running on trunk with native a few weeks back this worked fine. Also when I last tested it on a CXF build some months back it worked fine.<p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I will try to debug the code path through to AbstractInvocationHandler.getImplMethod() in order to see why it is looking at the wrong class and get back with any info I can find.</p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I debugged a case where the message has been misdirected and it appears that the delivery process goes awry in class org.jboss.wsf.stack.cxf.AbstractInvoker inside method _invokeInternal(Exchange exchange, Object o, WrappedMessageContext ctx). The problem appears to relate to the use of an InheritableThreadLocal. Here is the code:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><span style="font-family: courier new,courier;">private Object _invokeInternal(Exchange exchange, Object o, WrappedMessageContext ctx)<br/>&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160; BindingOperationInfo bop = exchange.get(BindingOperationInfo.class);<br/>&#160;&#160;&#160;&#160;&#160; MethodDispatcher md = (MethodDispatcher)exchange.get(Service.class).get(MethodDispatcher.class.getName());<br/>&#160;&#160;&#160;&#160;&#160; Method m = md.getMethod(bop);
</span><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-family: courier new,courier;"> </span>&#160;</p><span style="font-family: courier new,courier;">
&#160;&#160;&#160;&#160;&#160; Object[] params = NO_ARGS;<br/>&#160;&#160;&#160;&#160;&#160; List&lt;Object&gt; paramList = null;<br/>&#160;&#160;&#160;&#160;&#160; if (m.getParameterTypes().length != 0)<br/>&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (o instanceof List&lt;?&gt;)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; paramList = CastUtils.cast((List&lt;?&gt;)o);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; params = paramList.toArray();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; params = new Object[]{o};<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160; }
</span><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-family: courier new,courier;"> </span>&#160;</p><span style="font-family: courier new,courier;">
&#160;&#160;&#160;&#160;&#160; Endpoint ep = EndpointAssociation.getEndpoint();<br/>&#160;&#160;&#160;&#160;&#160; InvocationHandler invHandler = ep.getInvocationHandler();
</span><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-family: courier new,courier;"> </span>&#160;</p><span style="font-family: courier new,courier;">
&#160;&#160;&#160;&#160;&#160; Invocation inv = invHandler.createInvocation();<br/>&#160;&#160;&#160;&#160;&#160; InvocationContext invContext = inv.getInvocationContext();<br/>&#160;&#160;&#160;&#160;&#160; inv.getInvocationContext().addAttachment(WebServiceContext.class, getWebServiceContext(ctx));<br/>&#160;&#160;&#160;&#160;&#160; invContext.addAttachment(MessageContext.class, ctx);<br/>&#160;&#160;&#160;&#160;&#160; inv.setJavaMethod(m);<br/>&#160;&#160;&#160;&#160;&#160; inv.setArgs(params);
</span><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-family: courier new,courier;"> </span>&#160;</p><span style="font-family: courier new,courier;">
&#160;&#160;&#160;&#160;&#160; Object retObj = null;<br/>&#160;&#160;&#160;&#160;&#160; try<br/>&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; invHandler.invoke(ep, inv);
</span><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; . . .<br/></span></p></blockquote><p>The debugger shows the following:</p><blockquote class="jive-quote"><p><span style="font-family: courier new,courier;"><span>ctx { javax.xml.ws.wsdl.service --&gt; {</span><a class="jive-link-external-small" href="http://fabrikam123.com" target="_blank">http://fabrikam123.com</a><span>}InitiatorService,</span></span></p><p><span style="font-family: courier new,courier;"><span>&#160;&#160;&#160;&#160;&#160; javax.xml.ws.wsdl.port --&gt; {</span><a class="jive-link-external-small" href="http://fabrikam123.com" target="_blank">http://fabrikam123.com</a><span>}InitiatorPortType,</span></span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160; org.apache.cxf.request.uri --&gt; /interop11/ATInitiatorService</span></p><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160; . . . }<br/></span></p><p><span style="font-family: courier new,courier;">m = "public void com.jboss.transaction.txinterop.webservices.atinterop.sei.InitiatorPortTypeImpl.response()"<br/></span></p><p><span style="font-family: courier new,courier;">ep = org.jboss.wsf.framework.deployment.DefaultEndpoint@18138d9 {<br/></span></p><p><span style="font-family: courier new,courier;">&#160; name = jboss.ws:context=interop11,endpoint=Interop11ATParticipantService</span></p><p><span style="font-family: courier new,courier;">&#160; shortName = Interop11ATParticipantService</span></p><p><span style="font-family: courier new,courier;">&#160; urlPattern = /ATParticipantService</span></p><p><span style="font-family: courier new,courier;">&#160; targetBean = com.jboss.transaction.txinterop.webservices.atinterop.sei.ParticipantPortTypeImpl</span></p><p><span style="font-family: courier new,courier;">&#160;&#160; . . .</span> }</p></blockquote><p>So, the problem appears to be that the call to EndpointAssociation.getEndpoint() is returning the wrong endpoint. Now this is strange because it is a very simple function:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p><span style="font-family: courier new,courier;">&#160; private static final ThreadLocal&lt;Endpoint&gt; endpoint = new InheritableThreadLocal&lt;Endpoint&gt;();<br/><br/>&#160;&#160; public static Endpoint getEndpoint()<br/>&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160; return endpoint.get();<br/>&#160;&#160; }<br/></span></p></blockquote><p>Now this is a one way message which, as can be seen in the exception trace, is being dispatched by a worker pool thread. The handoff to this thread happens in the interceptor chain when one of the interceptors determines that this is a one way message. The interceptor queues the partially sent message and returns early so as not to block the JaxWS client. This can be seen in ContextUtils$1.run in the stack trace which is defined inside method ContextUtils.rebaseResponse.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><blockquote class="jive-quote"><p><span style="font-family: courier new,courier;">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (retrieveAsyncPostResponseDispatch(inMessage)) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //need to suck in all the data from the input stream as<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //the transport might discard any data on the stream when this <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //thread unwinds or when the empty response is sent back<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; DelegatingInputStream in = inMessage.get(DelegatingInputStream.class);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (in != null) {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; in.cacheInput();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // async service invocation required *after* a response<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // has been sent (i.e. to a oneway, or a partial response<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // to a decoupled twoway)<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // pause dispatch on current thread ...<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; inMessage.getInterceptorChain().pause();<br/><br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // ... and resume on executor thread<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; getExecutor(inMessage).execute(new Runnable() {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; public void run() {<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; inMessage.getInterceptorChain().resume();<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; });</span></p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>As you can see the message is queued to an executor obtained from the message. When I execute getExecutor(inMessage) in the debugger it does indeed return an executor. What is more when I execute the code in getExecutor it does indeed appear to be obtained from the Initiator service not the Participant service. However, when I looked at the threads in the Executor thread pool something is very wrong. The inheritedThreadLocalMap field in some of the threads has the Initiator port as the endpoint while in other threads it has the Participant port as the endpoint. So, something is resetting the thread local endpoint of Initiator service executor&#160; threads.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I don't know exactly why or where this is happening but I will try tracing calls to getEndpoint and setEndpoint in order to see if I can idenitfy what is doing the reset.</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/547157#547157">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Web Services CXF at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2046">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>