http://cwiki.apache.org/CXF/faq.html#FAQ-HowcanIaddsoapheaderstotherequest%252Fresponse%253F

This might be of interest to you. Check the section on Headers.
What you are asking probably is the option 4 in this section which allows you to get handle to the JAX-WS Request Context and add the header their which will be available at the other end in WebServiceContext when you add the resource injection as suggested by Dan.

If you need more help take a look at the system test here: http://svn.apache.org/repos/asf/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/outofband/header/

Regards,

Ulhas Bhole

Selena85 wrote:
Hey, could You show me how to inject the username into context. It should be
done in Spring or in Java code?

dkulp wrote:
On Jun 30, 2008, at 5:04 AM, Selena85 wrote:

Hello I'm newbie in CXF and Spring. My task is to prepear user
authenthication and to log user activities. Now I've got user
authenthication using WSS4JInInterceptor and callback - and it's work fine. My problem is, how to pass authentication data (username) to the endpoint implementor class (translatorServiceImpl). Is there any way to do this using
Spring (set a property in class translatorServiceImpl)?
No, because there is a single instance of the Impl created and is used during all invocations. The way this is done is to add:

@Resource
WebServiceContext ctx;

To your Impl and the context should get injected. From the context (which is thread local), you can query any items that are stored in the Message object in your interceptor.

Dan



<!-- Service endpoint -->
   <jaxws:endpoint id="translatorService"
       implementor="#translatorServiceImpl" address="/translation">
       <jaxws:serviceFactory>
           <ref bean="jaxws-and-aegis-service-factory" />
       </jaxws:serviceFactory>
       <jaxws:inInterceptors>
           <bean
class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
               <constructor-arg>
                   <map>
                       <entry key="action" value="UsernameToken" />
<entry key="passwordType" value="PasswordText" />
                       <entry key="passwordCallbackClass"

value="pl.waga.service.ServerAuthorizationCallback" />
                   </map>
               </constructor-arg>
           </bean>
       </jaxws:inInterceptors>
   </jaxws:endpoint>

--
View this message in context:
http://www.nabble.com/SOAP-Header-tp18191401p18191401.html
Sent from the cxf-user mailing list archive at Nabble.com.

---
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog









----------------------------
IONA Technologies PLC (registered in Ireland)
Registered Number: 171387
Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland

Reply via email to