You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andrew Clegg (JIRA)" <ji...@apache.org> on 2009/03/10 19:00:50 UTC

[jira] Created: (CXF-2101) Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue

Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue
-------------------------------------------------------------------------------------

                 Key: CXF-2101
                 URL: https://issues.apache.org/jira/browse/CXF-2101
             Project: CXF
          Issue Type: Bug
          Components: JAX-WS Runtime
    Affects Versions: 2.1.4
         Environment: JDK 1.6.0_10
            Reporter: Andrew Clegg


org.apache.cxf.jaxws.DispatchImpl extends org.apache.cxf.jaxws.BindingProviderImpl, which has a requestContext field:

protected ThreadLocal <Map<String, Object>> requestContext = 
    new ThreadLocal<Map<String, Object>>();

Because the request context is in a ThreadLocal, changes made to it are not visible when you invoke the service via DispatchImpl's invokeAsync method.

For example:

dispatch.getRequestContext().put(
        BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE );
dispatch.getRequestContext().put(
        BindingProvider.SOAPACTION_URI_PROPERTY, "uri:myAction" );

// If you call it this way, no SOAPAction header, verified by Wireshark:
Response<StreamSource> response = dispatch.invokeAsync( request );

// But if you call it this way, you get the header
StreamSource result = dispatch.invoke( request );

I can package up a test case if anyone thinks it would help fix this. Personally I know very little about CXF's internals, or the JAX-WS specs, but I can do whatever necessary to help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2101) Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue

Posted by "Andrew Clegg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681260#action_12681260 ] 

Andrew Clegg commented on CXF-2101:
-----------------------------------

Wouldn't that cause problems with other code that assumes clients are thread-safe? (I'm not at all familiar with CXF's internals though.)

> Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-2101
>                 URL: https://issues.apache.org/jira/browse/CXF-2101
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.1.4
>         Environment: JDK 1.6.0_10
>            Reporter: Andrew Clegg
>
> org.apache.cxf.jaxws.DispatchImpl extends org.apache.cxf.jaxws.BindingProviderImpl, which has a requestContext field:
> protected ThreadLocal <Map<String, Object>> requestContext = 
>     new ThreadLocal<Map<String, Object>>();
> Because the request context is in a ThreadLocal, changes made to it are not visible when you invoke the service via DispatchImpl's invokeAsync method.
> For example:
> dispatch.getRequestContext().put(
>         BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE );
> dispatch.getRequestContext().put(
>         BindingProvider.SOAPACTION_URI_PROPERTY, "uri:myAction" );
> // If you call it this way, no SOAPAction header, verified by Wireshark:
> Response<StreamSource> response = dispatch.invokeAsync( request );
> // But if you call it this way, you get the header
> StreamSource result = dispatch.invoke( request );
> I can package up a test case if anyone thinks it would help fix this. Personally I know very little about CXF's internals, or the JAX-WS specs, but I can do whatever necessary to help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2101) Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-2101.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.5
         Assignee: Daniel Kulp

> Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-2101
>                 URL: https://issues.apache.org/jira/browse/CXF-2101
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.1.4
>         Environment: JDK 1.6.0_10
>            Reporter: Andrew Clegg
>            Assignee: Daniel Kulp
>             Fix For: 2.1.5
>
>
> org.apache.cxf.jaxws.DispatchImpl extends org.apache.cxf.jaxws.BindingProviderImpl, which has a requestContext field:
> protected ThreadLocal <Map<String, Object>> requestContext = 
>     new ThreadLocal<Map<String, Object>>();
> Because the request context is in a ThreadLocal, changes made to it are not visible when you invoke the service via DispatchImpl's invokeAsync method.
> For example:
> dispatch.getRequestContext().put(
>         BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE );
> dispatch.getRequestContext().put(
>         BindingProvider.SOAPACTION_URI_PROPERTY, "uri:myAction" );
> // If you call it this way, no SOAPAction header, verified by Wireshark:
> Response<StreamSource> response = dispatch.invokeAsync( request );
> // But if you call it this way, you get the header
> StreamSource result = dispatch.invoke( request );
> I can package up a test case if anyone thinks it would help fix this. Personally I know very little about CXF's internals, or the JAX-WS specs, but I can do whatever necessary to help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2101) Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2101?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12681342#action_12681342 ] 

Daniel Kulp commented on CXF-2101:
----------------------------------


A temporary fix was put in to copy the request context when pushed onto the background thread.   That SHOULD allow this to work.  

> Cannot add headers to request from Dispatch client in async mode -- ThreadLocal issue
> -------------------------------------------------------------------------------------
>
>                 Key: CXF-2101
>                 URL: https://issues.apache.org/jira/browse/CXF-2101
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.1.4
>         Environment: JDK 1.6.0_10
>            Reporter: Andrew Clegg
>
> org.apache.cxf.jaxws.DispatchImpl extends org.apache.cxf.jaxws.BindingProviderImpl, which has a requestContext field:
> protected ThreadLocal <Map<String, Object>> requestContext = 
>     new ThreadLocal<Map<String, Object>>();
> Because the request context is in a ThreadLocal, changes made to it are not visible when you invoke the service via DispatchImpl's invokeAsync method.
> For example:
> dispatch.getRequestContext().put(
>         BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE );
> dispatch.getRequestContext().put(
>         BindingProvider.SOAPACTION_URI_PROPERTY, "uri:myAction" );
> // If you call it this way, no SOAPAction header, verified by Wireshark:
> Response<StreamSource> response = dispatch.invokeAsync( request );
> // But if you call it this way, you get the header
> StreamSource result = dispatch.invoke( request );
> I can package up a test case if anyone thinks it would help fix this. Personally I know very little about CXF's internals, or the JAX-WS specs, but I can do whatever necessary to help.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.