Example CustomSoapHeaderExtractor

package com.tibco.cim.authentication.webservice;
import java.util.HashMap;	
import java.util.Iterator;
import java.util.Map;
import org.apache.axiom.soap.SOAPHeaderBlock;
import com.tibco.cim.authentication.ExtractorInput;
import com.tibco.cim.authentication.IHeaderExtractor;
import com.tibco.mdm.infrastructure.error.MqException;
/**
 * 
 * 
 * Description: Custom soap header extractor.
 */
public class CustomSoapHeaderExtractor implements IHeaderExtractor {
    /**
     * Description: This method takes input parameter of type ExtractorInput and calls getMsgContext() which is used
     * to get the SoapHeaders, The Child elements of soap headers are assigned to an iterator which are iterated and
     * a check is been made for the custom parameter and the corresponding parameter is which CIM login module understand is assigned
     * This method returns extracted header map populated from the SoapHeaders 
     * 
     *    <soapenv:Header>
            <customUsername>a</username>
            <customPwd>a</customPwd>
            <customEnterprise>a</customEnterprise>
   			</soapenv:Header>
     * 
     * 
     * @return extracted headers
     */
	public Map<String,String> getHeaders(ExtractorInput input) throws MqException {
        //first get it from soap headers
        //Lets get headers
        Iterator itr = input.getMsgContext().getEnvelope().getHeader().getChildElements();
        Map<String,String> headerMap = new HashMap<String,String>() ;
       MqLog.log(this, MqLog.DEBUG,
            "=======HEADER START PROCESS=========");
       while (itr.hasNext()) {
            SOAPHeaderBlock headerBlock = (SOAPHeaderBlock)itr.next() ;
            String value = headerBlock.getText() ;
            String name = headerBlock.getQName().getLocalPart() ;
            if(name.equals("customUserName")){
            	name="username";
            }else if(name.equals("customPwd")){
            	name="pwd";
            }else if(name.equals("customEnterprise")){
            	name="enterprise";
            }
            headerMap.put(name, value) ;
        }
          MqLog.log(this, MqLog.DEBUG, "--HEADER END PROCESS--");
//Now get from http headers
        return headerMap ;
    }
}