Outbound callback service

Outbound callback service is useful when there is need to modify headers before sending to consumer or there is any other modification which needs to be perform on payload. For webservice provider outbound callback service can be used to modify response payload to client.

For this post, requirement was to change security header which is generated by IS. Rampart module always mustUnderstand attribute to 1 for security Policy, but here client wanted esb to send this attribute as 0 or not send at all. There is no out of the box setting to achieve this.

Outbound callback service was used to achieve this requirement.

1.0     Implementation

Below are the step by step explanation how to achieve this.

  1. Create a flow service in desired location, which will act as outbound call back service and will hold logic which needs to be performed. Use “pub.soap.utils:callbackServiceSpec” specification reference for this service.
  2. Open webservice consumer where outbound call back services are needed to be implemented. Look for outbound call back service property. Navigate and select the service created in last step. This is the only thing which needs to be done for webservice consumer.

    Outbound Callback Service Property
    Outbound Callback Service Property
  3. Come back to flow service created in first step and write logic for what need to be done in that service.
  4. Outbound service gets called at two phases during consumer connector call. First is PRESECURITY and second is TRANSPORT. For my requirement, header need to be changed on TRANSPORT phase as that is the last phase. If we add header at transport phase, then we run into risk of adding same header twice.
  5. Below is a screen shot of code written in outbound call back service.
    1. First getProperty is called with key as “CallbackPhase” which will return phase values as either “PRESECURITY” or “TRANSPORT”
    2. For this requirement we are forming security doc in service and adding using addHeaderBlock.
    3. Inbuilt services can be used to retrieve header from messageContext and then modify.
Outbound Callback Service Implementation
Outbound Callback Service Implementation

This is simple implementation of Outbound call back service. Depending on your requirement this can be expanded further.

1.0     References

http://documentation.softwareag.com/webmethods/wmsuites/wmsuite9-7/Integration_Server/9-7_Web_Services_Developers_Guide.pdf

Page 177

Leave a Reply

Your email address will not be published. Required fields are marked *