Monday, May 24, 2004

Basic Security - securing a web service

Ok once you have deployed a web service how do you make it secure.
Put the following snippet in the web.xml file

"
BASIC
Greeting Service


GreetingRole



Greeting Web Service
*


GreetingRole


NONE

"

just before the end tag ""

And in the orion-web.xml file, put the following xml snippet:





Now you are all set. Just deploy the web service again and you would be prompted to provide a user id and password.



As for the java client accessing the wsdl :
In the auto generated constructor, assuming u r using jdeveloper to create and deploy your web services: just provide the properties to the http connection.

Properties props = new Properties();
props.put(OracleSOAPHTTPConnection.AUTH_TYPE, "basic");
props.put(OracleSOAPHTTPConnection.USERNAME, "admin");
props.put(OracleSOAPHTTPConnection.PASSWORD, "welcome");
m_httpConnection.setProperties(props);

1 comment:

Anonymous said...

Vishal, The example seems to be incomplete. Could you please provide us then code snippet that should have gone here...

----------------------------------
And in the orion-web.xml file, put the following xml snippet
????
---------------------------------