Script Example for a Local Business Service
A portion of the sample script for a local business service used to add a custom SOAP header to an outbound Web service request is shown in the following example. Local variables, error handling, and object destruction are omitted for clarity.
// Create the SOAP header.
soapHdr.SetType("SOAP-ENV:header");
// Populate the SOAP header elements.
appId.SetType("ns1:ApplicationID");
appId.SetValue("Siebel");
pwd.SetType("ns1:PWS");
pwd.SetValue("123456789");
langCd.SetType("ns1:Lang");
langCd.SetValue("ENU");
uName.SetType("ns1:userID");
uName.SetValue("first.last@mycompany.com");
// Populate the profileHeader element.
profileHeader.SetType("authHeader");
profileHeader.SetProperty("xmlns:ns1", "http://siebel.com/authHeaders");
profileHeader.AddChild(appId);
profileHeader.AddChild(pwd);
profileHeader.AddChild(langCd);
profileHeader.AddChild(uName);
// SOAP header property set. Once this is complete, add the SOAP header as a child
of the Input property set (which contains the SOAP:body).
soapHdr.InsertChildAt(profileHeader, 0)
Inputs.InsertChildAt(soapHdr, 0);
// Convert the property set to a well-defined XML document.
// Using the XML Hierarchy Converter: must add a child element of type XMLHierarchy.
childPS.SetType("XMLHierarchy");
childPS.AddChild(Inputs);
inPs.AddChild(childPS);
inPs.SetProperty("EscapeNames", "FALSE");
inPs.SetProperty("GenerateProcessingInstructions", "FALSE");
xmlSvc.InvokeMethod("XMLHierToXMLDoc", inPs, outPs);
// Proxy the request through a trace utility to view the SOAP document.
// Set custom HTTP header - SOAPAction
outPs.SetProperty("HTTPRequestURLTemplate", "http://localhost:9000/search/beta2");
outPs.SetProperty("HTTPRequestMethod", "POST");
outPs.SetProperty("HTTPContentType", "text/xml; charset=UTF-8");
outPs.SetProperty("HDR.SOAPAction","customSOAPActionValue");
// Invoke the Web service using the standard HTTP protocol.
httpSvc.InvokeMethod("SendReceive", outPs, hpOut);
// Convert the SOAP document to a property set using the XML Converter, returning
the SOAP header and SOAP body.
xmlCtr.InvokeMethod("XMLToPropSet", hpOut, Outputs);
…
After you have created your business service, deliver its workspace.