Implementing Custom Header Extractor

Implement CustomSoapHeaderExtractor for web services.

Procedure

  1. Create the following package that provides the API for authenticating header from the web service:
    package com.tibco.cim.authentication.webservice;
  2. Create a CustomSoapHeaderExtractor class using an IDE or Notepad and include the import classes. For the list of import classes for soap header extractor, refer to Example CustomSoapHeaderExtractor.

    The import classes map single sign-on headers to TIBCO MDM authentication framework. The child elements of soap headers are assigned to an iterator. After these elements are iterated, a check is performed for the custom parameter.

  3. Implement IHeaderExtractor and override the following method:
    public Map<String,String> getHeaders(ExtractorInput input) throws MqException

    The IHeaderExtractor extracts headers and retrieves input parameters of the ExtractorInput type. The ExtractorInput parameter populates with getHttpRequest and getHttpResponse methods. However, in case of soap headers, it populates the getMsgContext() method. Following is the description of the methods of the ExtractorInput parameter:

    ExtractorInput Parameter’s Methods
    Method Description
    getHttpRequest() returns HttpServletRequest.
    getHttpResponse() returns HttpServletResponse.
    getMsgContext() returns MessageContext. This method is used in case of soap headers.

    This method returns the header map that is extracted and populated from the soap headers. For example,

   <soapenv:Header>

<customUsername>a</username>

<customPwd>a</customPwd>

<customEnterprise>a</customEnterprise>

    </soapenv:Header>

  1. Specify MQ_LOG while customizing the header extractor for debugging purpose.
  2. Compile the custom header extractor. For compilation, perform the following:
    • Package the implementation in a JAR file and merge it with TIBCO MDM EAR.
    • Add $MQ_HOME/lib/external/axiom-api-1.2.8.jar to the classpath.
    • Add $MQ_HOME/lib/mq/ECMClasses.jar to the classpath.
  3. Configure the custom header extractor. For more information on configuring, refer to Default Implementation for UI and Web Services.
  4. Verify the $SMQ_LOG/elink.log file.

    If the headers are successfully mapped and extracted, the following statements are displayed:

    <DATE> <TIME> DEBUG HEADER START PROCESS
    <DATE> <TIME> DEBUG HEADER END PROCESS