How to attach WS-Policy for Username token validation to a JAX-WS web service in a WebLogic application server

Note: the below has been tried on WebLogic 12c application server running on Linux platform.

Create the policy XML, say CustomUNTPolicy.xml, with the following content:

<?xml version=”1.0″?>
<wsp:Policy xmlns:wsp=”; xmlns:sp=”″&gt;
<sp:UsernameToken sp:IncludeToken=””&gt;

Add CustomUNTPolicy.xml in WEB-INF/policies directory of the web service WAR file.

Deploy the web service WAR

Go to Deployments -> <Web service> -> Configuration -> WS-Policy

Click on the service endpoint name

Select ‘WebLogic’ as the policy kind and click ‘Next’ button

You will see the entry ‘policy:CustomUNTPolicy.xml’ in the ‘Available Endpoint Policies’ table. Select this entry and move it to the ‘Chosen Endpoint Policies’ table. Then click ‘Finish’ button.

The server will prompt you to save the updated deployment plan. Select an appropriate path for the plan XML and click ‘OK’ button.

Click ‘Activate Changes’ button

Depending upon how your application is written, you might have to restart the server.

This entry was posted in Application Server, Java, Java EE, Web Services, WebLogic and tagged , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s