Showing posts with label WebService. Show all posts
Showing posts with label WebService. Show all posts

Monday, July 30, 2012

Web Service Security Policy

This blog explains about accessing Web Services secured with 'Useraname Token' policy:


‘Username Token’ is a WS security policy in which authentication information (user name and password) for accessing services, will be part of request xml header.

Corresponding Oracle WS Security policy is: 'oracle/wss_username_token_client_policy'

Java code to add information to request xml header:

 SecurityPoliciesFeature securityFeatures = new SecurityPoliciesFeature(new String[] { "oracle/wss_username_token_client_policy" });
 ProjectPortType projectPortType = projectService.getProjectPort(securityFeatures);
 Map<String, Object> reqContext = ((BindingProvider)projectPortType).getRequestContext();
 reqContext.put(BindingProvider.USERNAME_PROPERTY, "username");
 reqContext.put(BindingProvider.PASSWORD_PROPERTY, "password");