Implementing Custom Header Extractor
Implement CustomSoapHeaderExtractor for web services.
- Procedure
- Create the following package that provides the API for authenticating header from the web service:
package com.tibco.cim.authentication.webservice; - Create a CustomSoapHeaderExtractor class using an IDE or Notepad and include the import classes. For the list of import classes for soap header extractor, see 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.
- Implement IHeaderExtractor and override the following method:
public Map<String,String> getHeaders(ExtractorInput input) throws MqExceptionThe
IHeaderExtractorextracts headers and retrieves input parameters of theExtractorInputtype. TheExtractorInputparameter populates withgetHttpRequestandgetHttpResponsemethods. However, in case of soap headers, it populates thegetMsgContext()method. Following is the description of the methods of theExtractorInputparameter: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,
- Specify MQ_LOG while customizing the header extractor for debugging purpose.
- 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.
- Configure the custom header extractor. For more information about configuring, see Default Implementation for UI and Web Services.
- 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
<soapenv:Header>
<customUsername>a</username>
<customPwd>a</customPwd>
<customEnterprise>a</customEnterprise>
</soapenv:Header>