Thursday, June 17, 2010

Authenticating your web-Service through OWSM gateway

When we run irca schema three schemas are getting created by default

they are orabpel,oraesb and orawsm

In this exercise we will see about the orawsm

WSM stands for webservices security management.

Once you have installed SOA Suite you can open the owsm console using the following url

http://localhost:port/ccore

by default user id and password for owsm are admin/oracle.

ONce you will log in to the console you will get a screen like this.



Now click on Add New Component.

Now provide the details




Give Component name as some logical name,Component type will be gateway.

In the component URL provide url as

http://localhost:port/gateway

Please take care that this should be gateway

http://localhost:port/gateway as the .ear file which is deployed in the oc4j container is gateway

here something means you can give context as of your choice i have chosen it as testgateway.

Just register and you will get a component id.




Component id C0003003 is the default component id in my case however it used to be C0003001.

You can find this in the following file

SOA_HOME\owsm\config\gateway\gateway-config-installer.properties


Here you can find gateway.component.id=C0003003

By default if you create a component the component id is same as the component id mentioned in gateway.component.id

There can be only one component id and if you want to define other component id you can do so by creating another component

The new component thus created will be having different component id,However there is one important point

We can use only the component id which is registered in gateway-config-installer.properties

If you want to make another component running,you have to first change the component id which you wanted to run.

Goto the gateway-config-installer.properties and change the component id to the new id you wanted to.

In my case i wanted to change it to C0003001

So i went to the SOA_HOME\owsm\config\gateway\gateway-config-installer.properties location and change the value from

gateway.component.id=C0003001


once done the changes save it and now open a command console.

Go to the following location

SOA_HOME\owsm\bin

and use the following command

wsmadmin deploy gateway




Provide the orawsm password.

So finally it should get succedded




Once it is successfull you need to restart your server.


Now you can use the component id C0003001


This was an illustration of how you will use different component id however in our case we will be using the component id C0003003

as it was created by default for me.





Now go to policy management and click on Register Services

Now click on the Services



Add a new Service



Now provide service name and its version and provide the wsdl url that you wanted to be passed through a gateway.









Commit the changes



Now go to view details and find the new URL that has been created for the process.



Now in the tools test page check if this works.This is the url that you have to provide to the customer.



Now go to Policy Management -->Management Policies and choose the edit button for the test gateway which you have created.





It will come up with a screen like this



Add steps below the pipeline request to Extract credentials.





Configure it and Change the credential from http tp WS-BASIC



Add one more step below to File Authenticate.



Say ok and

Now before configuring


Create a folder structure

D:\Encrypt and within that create a file called a.htpasswd.

Within the file write arpit:arpit

which corresponds to (user:password)

This is the user id and password to authenticate.

go to command console

GO to SOA_HOME\owsm\bin

and execute following command

and execute the following command

wsmadmin md5encode D:\encrypt\a.htpasswd arpit



Provide arpit as password also when asked,it has to match with the userid and password provided in the a.htpasswd file


Now if you will check the a.htpasswd file you will find it is encrypted.

Now configure the file Authenticate

use the location of the password file and use md5 as file format.






Say ok and next and save the policy.Finally commit the policy.

Now again go to tools -->test page and test the page you will get an error like this.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode xmlns:p="http://schemas.oblix.com/ws/2003/08/Faults" xmlns="">p:Client.AuthenticationFault</faultcode><faultstring xmlns="">Invalid username or password</faultstring><detail xmlns=""/></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>




Now again invoke the same serive using credectials as shown below using WS-Security




Now this time invoke while including ws security and give the user id and password and now invoke it will work fine.

This was asynchronous process so we have set it for request only.

If it is a synchronous process then we can set it for both request and response parameters.

You can try for other format there are a lot of possibilies this is one example only.

No comments: