JBoss Community

JBossWS and Security Client dependency

created by stephen b in JBoss Web Services - View the full discussion

Hi,

 

I am currently trying to integrate Web service security to my web service following instructions from here https://docs.jboss.org/author/display/JBWS/WS-Security

 

The tutorial specified that I can create a client using code below. The tutorial did not explain which jar dependencies I have to use for this to work. I managed to build my project using Eclipse and added Apache CXF 2.4.6 library as project build dependecies and it works fine - client and server encrypts and decrypts the request/response.

 

QName serviceName = new QName("http://www.jboss.org/jbossws/ws-extensions/wssecuritypolicy", "SecurityService");

URL wsdlURL = new URL(serviceURL + "?wsdl");

Service service = Service.create(wsdlURL, serviceName);

ServiceIface proxy = (ServiceIface)service.getPort(ServiceIface.class);

 

((BindingProvider)proxy).getRequestContext().put(SecurityConstants.CALLBACK_HANDLER, new KeystorePasswordCallback());

((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_PROPERTIES,

     Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));

((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_PROPERTIES,

     Thread.currentThread().getContextClassLoader().getResource("META-INF/alice.properties"));

((BindingProvider)proxy).getRequestContext().put(SecurityConstants.SIGNATURE_USERNAME, "alice");

((BindingProvider)proxy).getRequestContext().put(SecurityConstants.ENCRYPT_USERNAME, "bob");

 

proxy.sayHello();

 

But when I use maven to build and run the test, client is not encrypting the SOAP message. I can't find any documentation which specifies the correct maven jar dependencies I have to add so that client side is able to encrypt the message. Based on logs and response from server it looks like the client did not send an encrypted SOAP message and service is throwing an Policy violation error to the client.

I tried to fix the issue by adding jboss-cxf-client as dependency but still the same issue.

 

My question is, what dependencies should I include to my POM file?

 

Thanks,

Stephen

Reply to this message by going to Community

Start a new discussion in JBoss Web Services at Community