<!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">JBoss 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;">
Continuing problem with XTS WS-T tests in AS trunk/CXF 2.2.9
</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/553969#553969">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi Jim,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I am not sure what is different in my code that makes request.getScheme() fail with an NPE while your code works ok but I think it is just luck.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I traced execution through a test case and it appears that the incoming message relates to a valid request. Because this is a one way message there is a handover of control in ContextUtils at line 416</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><span style="font-family: courier new,courier;">416                     inMessage.getInterceptorChain().pause();
</span><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-family: courier new,courier;"> </span> </p><span style="font-family: courier new,courier;">
                        // ... and resume on executor thread<br/>                        getExecutor(inMessage).execute(new Runnable() {<br/>                            public void run() {<br/>421                             inMessage.getInterceptorChain().resume();<br/>                            }
</span><p style="min-height: 8pt; height: 8pt; padding: 0px;"><span style="font-family: courier new,courier;"> </span> </p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I checked the request by stopping at 416 and looking up the stack to find the request. The HttpServletRequest object is actually a facade object which indirects to an underlying catalina connector request. It had a name like "Current Servlet stack for thread http-127.0.0.1-8080-1 [S] ActivationService [org.jboss.wsf.stack.cxf.CXFServletExt]". request.getScheme() worked on this object without a NPE.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I picked control up again in the debugger at 421 but, of course, there was no servlet method up the stack where I coudl locate the request. So, I proceeded to step through the code until the ServiceInvokerInterceptor was called. In AbstractInvoker.invoke() the web service context is set up</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><p><span style="font-family: courier new,courier;">public Object invoke(Exchange exchange, Object o)<br/>   {<br/>      // set up the webservice request context <br/>      WrappedMessageContext ctx = new WrappedMessageContext(exchange.getInMessage(), Scope.APPLICATION);<br/><br/>      Map<String, Object> handlerScopedStuff = removeHandlerProperties(ctx);<br/><br/>      WebServiceContextImpl.setMessageContext(ctx);<br/><br/>101   Object retObj = null;</span></p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>At line 101 I evaluated ctx.get("HTTP.REQUEST") and got another facade hiding a catalina connector request with name "Current Servlet stack for thread default-workqueue-2". However all the fields of this catalina connector request appear to be uninitialised and getScheme() returns null. So, this looks to me like the request is coming out of a thread local and it is pot luck whether the object behind the facade has been initialised or not. IN your tests it may be that a previous call has set values in this object.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>regards,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Andrew Dinn</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/553969#553969">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>