On Mon October 5 2009 9:00:01 am Dejan Markic wrote:
> Hello!
>
> Got that working.
>
> Setting: <jaxws:client
> name="{http://cdb.services.np.aek.seavus.com/}NetworkOperatorWS_ImplPort"
> createdFromAPI="true"> without "id", pulls this configuration when using
> direct call eg: java
> mobik.np.NetworkOperatorWS_NetworkOperatorWSImplPort_Client
>
> Now I'm wondering, I'm trying to call this also from JSP, again it calls it
> alright, but without security headers. How should I configure the web.xml
> and/or cxf.xml to use interceptors?!
Most likely, You'll need to manually configure/create a Bus prior to the
client creation to make sure the proper config file is picked up. Not really
sure though.
Something like:
URL url = getResource("/WEB-INF/cxf.xml")
SpringBusFactory.createBus(url)
then create the clients and such.
One more note: with 2.1.x, you don't need to configure in the SAAJ stuff.
WSS4J interceptors will automatically do that as needed.
Dan
>
> Thanks and kind regards,
> Dejan
>
> -----Original Message-----
> From: Dejan Markic [mailto:[email protected]]
> Sent: Monday, October 05, 2009 10:19 AM
> To: [email protected]
> Subject: WSDL2Java generated client not picking up interceptors
>
> Hello all!
>
> I'm banging my head with this one for over a week. I've created services
> with WSDL2Java applied interceptors to it to use WSS and all works fine.
> Now I want to run clients also and I can't seem to get interceptors
> working. I've created client from WSDL with (WSDL2Java) and configured the
> cxf.xml like you see in attached file.
>
> When I try to configure jaxws:client like:
> <jaxws:client
> id="{http://cdb.services.np.aek.seavus.com/}NetworkOperatorWS_ImplPort"
> createdFromAPI="true"> <jaxws:inInterceptors>
> <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" /> <ref
> local="wssInInterceptor" />
> </jaxws:inInterceptors>
> <jaxws:outInterceptors>
> <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"
> /> <ref local="wssOutInterceptor" />
> </jaxws:outInterceptors>
> </jaxws:client>
>
> I get an error when I try to run the client like this: java
> mobik.np.NetworkOperatorWS_NetworkOperatorWSImplPort_Client Exception in
> thread "main" java.lang.RuntimeException:
> org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException:
> Line 99 in XML document from file
> [/var/lib/tomcat5.5/webapps/np/WEB-INF/classes/cxf.xml] is invalid; nested
> exception is org.xml.sax.SAXParseException: cvc-datatype-valid.1.2.1:
> '{http://cdb.services.np.aek.seavus.com/}NetworkOperatorWS_ImplPort' is
> not a valid value for 'NCName'.
>
> If I set jaxws:client like this:
> <jaxws:client id="client"
> name="{http://cdb.services.np.aek.seavus.com/}NetworkOperatorWS_ImplPort"
> createdFromAPI="true"> <jaxws:inInterceptors> <bean
> class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor" /> <ref
> local="wssInInterceptor" />
> </jaxws:inInterceptors>
> <jaxws:outInterceptors>
> <bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"
> /> <ref local="wssOutInterceptor" />
> </jaxws:outInterceptors>
> </jaxws:client>
>
> Then client is working, but security headers are not added, so I guess
> interceptors are not used at all?!
>
> Any clues on how to get interceptors working?
>
> Thank you and kind regards,
> Dejan
>
--
Daniel Kulp
[email protected]
http://www.dankulp.com/blog