Monday, March 5, 2012

Calling a Security Enable siebel webservice


Hi Everyone,
I would like to share, how to call the security enabled siebel webservice in the Jdeveloper.
Normally we use to generate the proxy client using wsdl file in the the JDeveloper, then will write our own service method in the client class. After that we create the data control for that. So that we can use that method as a method binding in the page.

What happens when you call a secured webservice ?

When you call the secured service, it expects the credentials in the header message. For a secured webservice it will have the soap header message in the wsdl. we can handle with this code to set the credentials

Map reqContext =
((BindingProvider)rRS_SITE_INFO_PortType).getRequestContext();
reqContext.put(BindingProvider.USERNAME_PROPERTY, "");
reqContext.put(BindingProvider.P
ASSWORD_PROPERTY, "");


While calling the siebel service, even though you the set the credentials using the above code , it will give the exception like this,


Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Unable to process SOAP Header child element 'wsse:Security' with 'mustUnderstand="1"'(SBL-EAI-08000)


It will expect the soap header message with the username and password, For that we have to send the header message in the request. use the SOAPHandler calss in avoid this exception.

I have attached the handler here. SOAPHandler.java Add this class into your applicaiton.

1. Create a proxy from the WSDL, right click on the client -> Select properties


2. From the proxy editor wizard goto choose Edit Handler->then select the port



3. Choose the added handler. click Add->Browse-> select the Handler class.





For every service request the handler will add the header message with the username token.

For more details about creating proxy and webservices,
http://docs.oracle.com/cd/B31017_01/core.1013/b28764/web_services003.htm
http://st-curriculum.oracle.com/obe/jdev/obe11jdev/ps1/webservices/ws.html