Bookshelf Home | Contents | Index | PDF |
Integration Platform Technologies: Siebel Enterprise Application Integration > Web Services > About Custom SOAP Filters > Enabling SOAP Header Processing Through FiltersFor each operation, you can set the inbound and outbound filters to be run. You can also define the methods you want to call on the filter. The following code sample illustrates a filter that has been written for the handling of custom SOAP headers. The interface provided by this code sample lets you define the method on the filter that you want to call, as well as the corresponding input and output parameters. function Service_PreInvokeMethod (MethodName, Inputs, Outputs) { if(MethodName == "StripHeader") { if(Inputs.GetChildCount() > 0) { // Set the input SOAP message property set as the output. Outputs.InsertChildAt(Inputs.GetChild(0), 0); var soapEnv = Outputs.GetChild(0); if(soapEnv.GetChildCount() == 2) // headers and body { // Here is where the header is found and processed. var count = soapEnv.GetChildCount(); // Use a loop just in case the header is not the first hierarchy. // For simplicity, the string comparison must be done using the exact same value if (soapEnv.GetChild(i).GetType() == "soapenv:Header") { // Found the header. Now it is processed. var soapHeader = soapEnv.GetChild(i); // This example assumes that the following header hierarchy is received: // <headerParam1>Value1</headerParam1> // <headerParam2>Value2</headerParam2> // <headerParam3>Value3</headerParam3> // The parameters headerParam1, headerParam2, and headerParam3 // are saved into variables. Nothing further done with them. headerParam1 = soapHeader.GetChild(0); headerParam2 = soapHeader.GetChild(1); headerParam3 = soapHeader.GetChild(2); break; // Stop the loop after the header is found. // Must remove the header from the SOAP property set. else if(MethodName == "AddHeader") { if(Inputs.GetChildCount() > 0) { // Create the SOAP header hierarchy with the desired data. var soapHeader = TheApplication().NewPropertySet(); soapHeader.SetType("soapEnv:Header"); soapHeader.SetProperty("xmlns:soapEnv", // These will be created as property sets because we want the following header: // <headerParam1>Value1</headerParam1> // <headerParam2>Value2</headerParam2> // <headerParam3>Value3</headerParam3> var param1PS = TheApplication().NewPropertySet(); var param2PS = TheApplication().NewPropertySet(); var param3PS = TheApplication().NewPropertySet(); param1PS.SetType("headerParam1"); param2PS.SetType("headerParam2"); param3PS.SetType("headerParam3"); // Add the data to the SOAP header. soapHeader.AddChild(param1PS); soapHeader.AddChild(param2PS); soapHeader.AddChild(param3PS); // Get the SOAP envelope from the SOAP hierarchy. var soapEnv = Inputs.GetChild(0); // Add the header to the SOAP envelope. soapEnv.InsertChildAt(soapHeader, 0); |
Integration Platform Technologies: Siebel Enterprise Application Integration | Copyright © 2013, Oracle and/or its affiliates. All rights reserved. Legal Notices. | |