Discussion:
How to verify username and password authention-WS-Security on JAXWS-Client?
Rajaganapathi Rajaganapathi
2012-01-18 11:33:27 UTC
Permalink
Hi,

I am trying to consume web service with CXF.

http://www.mulesoft.org/documentation/display/MULE3USER/Consuming+Web+Services+with+CXF

As said in the above example I have created one client without generating from WSDL.

Now I need to check with Username & Password to enable WS-Security.

Can you please help me here to enable Usernametoken on JAX-WS-Client?

Here is my code, <flow name="greeterFlow" doc:name="greeterFlow"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="63083" path="services/greeter" doc:name="HTTP"/> <byte-array-to-string-transformer doc:name="Byte-Array-to-String"/> <logger message="after string conversion ---&gt; #[payload]" level="INFO" doc:name="Logger"/> <cxf:jaxws-client operation="greetMe" serviceClass="org.apache.hello_mule.HelloService" enableMuleSoapHeaders="true" doc:name="SOAP"/> <http:outbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="services/greeter" method="POST" contentType="text/xml" keep-alive="true" doc:name="HTTP"/> </flow> <flow name="wsdsFlow1" doc:name="wsdsFlow1"> <http:inbound-endpoint exchange-pattern="request-response" host="localhost" port="8081" path="services/greeter" keep-alive="true" doc:name="HTTP"/> <logger message="inbound message to stub ---&gt; #[payload]" level="INFO" doc:name="Logger"/>
<cxf:jaxws-service serviceClass="org.apache.hello_mule.HelloService" enableMuleSoapHeaders="false" doc:name="SOAP"/>
<component class="org.apache.hello_mule.HelloServiceImpl" doc:name="Java"/>
</flow>



Thanks in advance.



Regards,
Rajaganapathi

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email
Rajaganapathi Rajaganapathi
2012-02-08 10:55:28 UTC
Permalink
Hi All,

I have enabled UsernameToken Scenario in WS-Security successfully.
We have to create java objects from WSDL (created from cxf:jaxws-service) using WSDL2Java.
Then configure the client with created java objects.
Below is the client config,

*<cxf:jaxws-client operation="echo" clientClass="org.apache.hello_mule.EchoService" port="EchoPort" wsdlLocation="classpath:/Echo.wsdl" doc:name="SOAP">*
*<cxf:outInterceptors>*
*<spring:bean class="org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor"/>*
*<spring:bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">*
*<spring:constructor-arg>*
*<spring:map>*
*<spring:entry key="action" value="UsernameToken"/>*
*<spring:entry key="user" value="key"/>*
*<spring:entry key="passwordType" value="PasswordDigest"/>*
*<spring:entry key="passwordCallbackRef" value-ref="clientCallback"/>*
*</spring:map>*
*</spring:constructor-arg>*
*</spring:bean>*
*</cxf:outInterceptors>*
*</cxf:jaxws-client>*

and server config is as,

*<cxf:jaxws-service port="80" serviceClass="org.apache.hello_mule.Echo" enableMuleSoapHeaders="false" doc:name="SOAP">*
*<cxf:inInterceptors>*
*<spring:bean class="org.apache.cxf.binding.soap.saaj.SAAJInInterceptor"/>*
*<spring:bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">*
*<spring:constructor-arg>*
*<spring:map>*
*<spring:entry key="action" value="UsernameToken"/>*
*<spring:entry key="passwordCallbackRef" value-ref="serverCallback"/>*
*</spring:map>*
*</spring:constructor-arg>*
*</spring:bean>*
*</cxf:inInterceptors>*
*</cxf:jaxws-service>*

Hope it will be helpful for others.
Cheers.

Regards
Rajaganapathi

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

Loading...