> Is it thread safe ? http://cxf.apache.org/faq.html#FAQ-AreJAXWSclientproxiesthreadsafe%3F
All you need is a JAX-WS client proxy, how you obtain one or set up your project is up to you... Colm. On Tue, Sep 24, 2013 at 2:07 PM, Thomas Manson <[email protected]>wrote: > Hi Colm, > > I'm starting to understand that it's another way to configure the client. > > I've two questions : > > - Is it thread safe ? > I guess that it is as I see that the ServiceBus specify a Thread. > In a J2EE context, should I specify something else than > SpringBusFactory.setThreadDefaultBus(bus); ? > > > - I'm a bit puzzled by the configuration: > > > SpringBusFactory bf = new SpringBusFactory(); > URL busFile = UsernameTokenTest.class.getResource("client/client.xml"); > > > This code load a Spring configuration file, while I already have mine + > the client.xml configuration has some cxf:bus definition (is it the same > thing ? SringBusFactory & cxf:bus ?). > > So I wonder I can't just use this code in an existing spring context, How > should I transpose this within an existing spring context? > > > How I think it would work is : > > > - Use your way to setup SpringBus and the Client > - Have a Spring class X that has the WS Client as dependency > - X implement each method of the WS(+some additional business logic) > and set the username dynamically <= I still don't know how to do this... > > Is it the correct way ? > > Thomas. > > Here is my current work in progress spring file > > <beans xmlns="http://www.springframework.org/schema/beans" > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf=" > http://cxf.apache.org/core" > xsi:schemaLocation=" > http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd > http://www.springframework.org/schema/beans > http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> > > > <cxf:bus> > <cxf:features> > <cxf:logging /> > </cxf:features> > </cxf:bus> > > > > <!-- > /Users/tmanson/Dropbox/crf/AMXBPM-2.1-WS-Client/src/main/resources/de.wsdl > --> > <jaxws:client > name="{http://services.brm.n2.tibco.com}EntityResolverService" > > wsdlLocation="/Users/tmanson/Dropbox/crf/AMXBPM-2.1-WS-Client/src/main/resources/de.wsdl" > serviceClass="com.tibco.n2.de.services.EntityResolverService" > address="http://192.168.2.202:8080/amxbpm/EntityResolverService" > createdFromAPI="true"> > <jaxws:properties> > <entry key="ws-security.callback-handler" > > > value="com.mansonthomas.amxbpm.customwebapp.services.amxbpm.security.PasswordCallbackHandler" > /> > </jaxws:properties> > </jaxws:client> > > </beans> > > > > > > > > > > On Tue, Sep 24, 2013 at 11:41 AM, Colm O hEigeartaigh <[email protected] > > wrote: > >> Look at the last test here: >> >> >> http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security/src/test/java/org/apache/cxf/systest/ws/ut/UsernameTokenTest.java?view=markup >> >> >> ((BindingProvider)utPort).getRequestContext().put(SecurityConstants.USERNAME, >> "Alice"); >> >> Colm. >> >> >> On Tue, Sep 24, 2013 at 10:33 AM, Thomas Manson >> <[email protected]>wrote: >> >> > Hi Colm, >> > >> > I'm back working on this subject (was on pause as I was working for >> other >> > clients) >> > >> > I've checked out the SVN repo you gave me, and I've looked through the >> > samples configurations (client.xml) and I can't find anything >> appropriate. >> > >> > In the UT (Username Token I guess), the username is always provided in >> the >> > configuration file. >> > The saml/x509 configuration still refers to Alice.properties... >> > >> > >> > In my case, the username shouldn't appear in the configuration files, >> as >> > I need to use the J2EE Principal as login, and call the webservice to >> > authenticate the user. >> > >> > Could you point me to the right direction ? >> > >> > Thomas. >> > >> > >> > >> > >> > >> > On Sat, Jul 13, 2013 at 1:45 AM, Thomas Manson >> > <[email protected]>wrote: >> > >> > > Thanks, it will surely help a lot :) >> > > >> > > Thomas. >> > > >> > > >> > > On Fri, Jul 12, 2013 at 6:05 PM, Colm O hEigeartaigh < >> > [email protected]>wrote: >> > > >> > >> Please take a look at the tests here: >> > >> >> > >> >> > >> >> > >> http://svn.apache.org/viewvc/cxf/branches/2.7.x-fixes/systests/ws-security-examples/ >> > >> >> > >> Colm. >> > >> >> > >> >> > >> On Fri, Jul 12, 2013 at 4:22 PM, Thomas Manson >> > >> <[email protected]>wrote: >> > >> >> > >> > Do you have any other pointer that this page : >> > >> > >> > >> > cxf.apache.org/docs/ws-securitypolicy.html >> > >> > >> > >> > it's way to short for me as documentation to build something that >> > work. >> > >> > When I read the properties described, I feel there's a mix between >> > >> server >> > >> > side properties (which I'm not interested as I'm just implementing >> a >> > >> > client)... + it starts with extra properties... where are the basic >> > >> ones? >> > >> > >> > >> > what would help is a full example of the code of a client. >> > >> > >> > >> > I'm quite lost ;) >> > >> > >> > >> > >> > >> > >> > >> > >> > >> > On Fri, Jul 12, 2013 at 5:09 PM, Colm O hEigeartaigh < >> > >> [email protected] >> > >> > >wrote: >> > >> > >> > >> > > >> > >> > > If you follow the WS-SecurityPolicy approach then it will work, >> as >> > >> all of >> > >> > > the configuration is taken from the context rather than a >> properties >> > >> Map. >> > >> > > >> > >> > > Colm. >> > >> > > >> > >> > > >> > >> > > On Fri, Jul 12, 2013 at 4:01 PM, Thomas Manson < >> > >> > [email protected] >> > >> > > > wrote: >> > >> > > >> > >> > >> I already does what you say as follow, but it mean one >> instance of >> > >> the >> > >> > >> client per user connected. >> > >> > >> >> > >> > >> >> > >> > >> I've search quite some time dans didn't find a way to set >> something >> > >> like >> > >> > >> the password callback handler. >> > >> > >> >> > >> > >> >> > >> > >> >> > >> > >> JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean(); >> > >> > >> >> > >> > >> factory.setServiceClass(WorkListService.class); >> > >> > >> >> > >> > >> factory.setAddress(this.endpoint); >> > >> > >> >> > >> > >> // >> > >> > >> >> > >> > >> > >> >> > >> factory.setWsdlLocation("D:/ARTIC/SOURCE/artic/trunk/webapp/src/main/webapp/WSDL/brm.wsdl"); >> > >> > >> >> > >> > >> factory.setServiceName(new QName(" >> > >> http://services.brm.n2.tibco.com >> > >> > ", >> > >> > >> "WorkListService")); >> > >> > >> >> > >> > >> WorkListService workListService = (WorkListService) >> > >> > factory.create(); >> > >> > >> >> > >> > >> >> > >> > >> Client client = ClientProxy.getClient(workListService); >> > >> > >> >> > >> > >> >> > >> > >> Map<String, Object> properties = new HashMap<String, >> Object>(); >> > >> > >> >> > >> > >> properties.put(WSHandlerConstants.ACTION , >> > >> > >> WSHandlerConstants.USERNAME_TOKEN); >> > >> > >> >> > >> > >> properties.put(WSHandlerConstants.USER , >> > >> this.username); >> > >> > >> >> > >> > >> properties.put(WSHandlerConstants.PASSWORD_TYPE , >> > WSConstants. >> > >> > >> PW_TEXT);// "PasswordDigest" >> > >> > >> >> > >> > >> properties.put(WSHandlerConstants.PW_CALLBACK_REF , >> > >> > newPasswordCallbackHandler( >> > >> > >> this.username, password, "password")); >> > >> > >> >> > >> > >> >> > >> > >> client.getOutInterceptors().add(new >> > >> > WSS4JOutInterceptor(properties)); >> > >> > >> >> > >> > >> >> > >> > >> On Fri, Jul 12, 2013 at 4:36 PM, Colm O hEigeartaigh < >> > >> > [email protected] >> > >> > >> > wrote: >> > >> > >> >> > >> > >>> ou could create a CXF interceptor that sets the username on the >> > fly, >> > >> > >>> before the WSS4JOutInterceptor is called. >> > >> > >> >> > >> > >> >> > >> > >> >> > >> > >> >> > >> > > >> > >> > > >> > >> > > -- >> > >> > > Colm O hEigeartaigh >> > >> > > >> > >> > > Talend Community Coder >> > >> > > http://coders.talend.com >> > >> > > >> > >> > >> > >> >> > >> >> > >> >> > >> -- >> > >> Colm O hEigeartaigh >> > >> >> > >> Talend Community Coder >> > >> http://coders.talend.com >> > >> >> > > >> > > >> > >> >> >> >> -- >> Colm O hEigeartaigh >> >> Talend Community Coder >> http://coders.talend.com >> > > -- Colm O hEigeartaigh Talend Community Coder http://coders.talend.com
