Siebel Web UI Dynamic Developer Kit Guide > Using Native Web Service Technology Stacks >
Example of Setting and Getting SOAP Headers Using Oracle WebLogic
The following example demonstrates how to set and get Siebel session management and authentication SOAP headers using Oracle Web Logic. public class SessionAccessControlTest implements com.bea.jws.WebService { static final long serialVersionUID = 1L;
/** @common:control */ public WSDLFolder.SessionAccessControl sessionAccessControl; /** * @common:operation */ public MySessionBean Login(String Username,String Password) { MySessionBean sessiontok=new MySessionBean();
HeaderDocument hd = null; try { hd = HeaderDocument.Factory.parse( "<SOAP-ENV:Header xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<ns1:SessionType xmlns:ns1=\"http://siebel.com/webservices\">Stateless</ns1:SessionType>" + "<ns2:UsernameToken xmlns:ns2=\"http://siebel.com/webservices\">"+Username+"</ns2:UsernameToken>" + "<ns3:PasswordText xmlns:ns3=\"http://siebel.com/webservices\">"+Password+"</ns3:PasswordText>" + "</SOAP-ENV:Header>"); Element h1 = (Element) hd.newDomNode().getFirstChild(); sessionAccessControl.setOutputHeaders(new Element[] { h1});
} catch (XmlException xe) {
System.out.println(xe.toString()); } sessionAccessControl.SessionAccessPing(""); Element e[]=sessionAccessControl.getInputHeaders(); sessiontok.SetValue(e[0].getFirstChild().getFirstChild().getNodeValue()); System.out.println("sESSION id "+ sessiontok.getValue());
return sessiontok; }
}
|