Secured WebServices – I
“How to create secured webservices? “
“How to access secured services in webDynpro? “
“How can i get rid of hard coding user credentials in my webdynpro code “
So lets starts how can we do this using Netweaver Studio. We will take very simple example (i.e) creating a Calculator service
1. Creating secured WebService
1.1 Goto “J2EE Development perspective” , Create Enterprise Application Project with name “SimpleApp”
1.2 Select File->New-> create new EJB Module project .
1.3 Right click on the project select New -> EJB
1.4 Give EJB Name and select “stateless session bean” from Beantype.Enter the packageName and choose “Finish”
1.5 Open the Bean add a business method “add” which takes two integer parameters and return integer(sum of two numbers).
1.6 Right Click on the bean, select WebService and provide the details like WebService Name , EAR project etc
1.7 Open WebService Definitions and go to features Tab.Select Authentication from the list and choose “Basic (Username.password) radio button as shown below
1.8 Now Build the EJB Archive and add it to EAR Project
1.9 Select EAR project and Build application archive and deploy the .ear file.
2. Testing the webservice
2.1 Go to Window->ShowView->Other->WebServices-> select WebServiceNavigator
2.2 Expand the “servers->Local server” node in the WebServiceNavigator window. You should be able to see list of webservices deployed on to your WAS
2.3 Rightclick on the webservice and choose Open
2.4 Go to “Test” menu, you can see the methods exposed by the webservice
2.5 Click on the method and enter the two parameter values
2.6 In the next screen it will ask for the username and password
2.7 You can see the result/response once you submit the user details
I will be explaining about consuming this service in webDynpro in my next Blog