How to write a Java Client supplying username/password for a WebService secured using the oracle/wss_username_token_service_policy

In the EM Console go to the ‘Test’ page for the service you are developing a client for and copy the WSDL url.

WSDLFromEM

In JDeveloper, in your Java Project, create a new Web Service Proxy

NewWSProxy

When setting the wsdl url, change ‘wsdl’ to ‘orawsdl’

orawsdl

Go through the wizard accepting the defaults and setting appropriate package names for the generated classes. In the Client policy section, select ‘oracle/wss_username_token_service_policy’

SelectClientPolicy

When you finish this wizard the Web Service client classes will be generated. Look at the code below to see how the User Id and Password are set when calling the Web Service.

Jaideep