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

Jaideep has more than 20 years of professional software development experience. He has delivered solutions for several domains including financial services, e-Government, criminal justice, and wireless application services. He is a Certified Scrum Master and has mentored several teams to use agile software development techniques. He has delivered several SOA/BPM solutions based on the BEA/Oracle SOA Suite over the last 6 years . His current focus is on helping customers build solutions using Oracle BPM, Webcenter, ADF and SOA Suite 11g and 12c. Jaideep also trains teams on using Oracle BPM and has developed several self paced online video training courses for Oracle BPM 11g and 12c.
Jaideep

Leave a Reply

avatar
  Subscribe  
Notify of