Integration Platform Technologies: Siebel Enterprise Application Integration > Web Services > About Custom SOAP Filters >

Enabling SOAP Header Processing Through Filters


For each operation, you can set the inbound and outbound filters to be run. You can also define the methods you want to invoke 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 invoke, and also the corresponding input and output parameters.

  function Service_PreInvokeMethod (MethodName, Inputs, Outputs)

  {

if(MethodName == "StripHeader")

{

if(Inputs.GetChildCount() > 0)

{

Outputs.InsertChildAt(Inputs.GetChild(0), 0);

var soapEnv = Outputs.GetChild(0);

if(soapEnv.GetChildCount() == 2) // headers and body

{

   var callBackHeader = soapHeader.GetChild(0);

   if(callBackHeader.GetChildCount() == 2)

   {

      var headerContext = TheApplication().NewPropertySet();

      headerContext.SetType("HeaderContext");

      // get the header child property set

      var callBackLocnHeader = callBackHeader.GetChild(0);

      var correlationIdHeader = callBackHeader.GetChild(1);

      headerContext.AddChild(callBackLocnHeader);

      headerContext.AddChild(correlationIdHeader);

      soapHeader.RemoveChild(0);

      Outputs.AddChild(headerContext);

   }

}

}

}

else if(MethodName == "AddHeader")

{

if(Inputs.GetChildCount() > 0)

{

Outputs.InsertChildAt(Inputs.GetChild(0), 0);

var soapEnv = Outputs.GetChild(0);

      var soapHeader = TheApplication().NewPropertySet();

      soapHeader.SetType("soapEnv:Header");

      soapHeader.SetProperty("xmlns:soapEnv", "http://schemas.xmlsoap.org/soap/envelope/");

      var correlationIdHeader = TheApplication().NewPropertySet();

      correlationIdHeader.SetType("CorrelationId");

if(Inputs.GetChildCount() == 2)

{

// get the correlation id from soap header context

var soapHeaderCntxt = Inputs.GetChild(1);

var corIdHeader = soapHeaderCntxt.GetChild(0);

correlationIdHeader.SetValue(corIdHeader.GetValue());

}

else

{

  // set default correlation id header

  correlationIdHeader.SetValue("30");

}

soapHeader.AddChild(correlationIdHeader);

soapEnv.InsertChildAt(soapHeader, 0);|

}

}

else if(MethodName == "AddPSHeader")

{

if(Inputs.GetChildCount() > 0)

{

Outputs.InsertChildAt(Inputs.GetChild(0), 0);

var soapEnv = Outputs.GetChild(0);

      var soapHeader = TheApplication().NewPropertySet();

      soapHeader.SetType("PropertySetHeader");

      soapHeader.SetProperty("xmlns:PropertySet", "http://www.siebel.com/propertyset");

                 var correlationIdHeader = TheApplication().NewPropertySet();

                 correlationIdHeader.SetType("CorrelationId");

      if(Inputs.GetChildCount() == 2)

      {

        // get the correlation id from soap header context

        var corIdHeader = soapHeaderCntxt.GetChild(0);

        correlationIdHeader.SetValue(corIdHeader.GetValue());

      }

      else

      {

        // set default correlation id header

        correlationIdHeader.SetValue("30");

      }

      soapHeader.AddChild(correlationIdHeader);

      soapEnv.InsertChildAt(soapHeader, 0);

}

}

return (CancelOperation);

  }

Integration Platform Technologies: Siebel Enterprise Application Integration Copyright © 2008, Oracle and/or its affiliates. All rights reserved. Legal Notices.