Search code examples
web-servicessoapibm-integration-busextended-sql

SOAP implicit headers


I want to add a custom implicit soap header to my response.

MsqFlow:

enter image description here

ESQL:

CREATE FUNCTION Main() RETURNS BOOLEAN
    BEGIN
        SET OutputRoot.MQMD = InputRoot.MQMD;
        CREATE LASTCHILD OF OutputRoot DOMAIN 'SOAP' NAME 'SOAP';
        SET OutputRoot.SOAP.Header.eaie:apiHeader.messageId = UUIDASCHAR;
        SET OutputRoot.SOAP.Header.eaie:apiHeader.timestamp = CURRENT_TIMESTAMP;
        SET OutputRoot.SOAP.Header.eaie:apiHeader.transactionId = Environment.Variables.Generic.Session.TransactionId;
        SET OutputRoot.SOAP.Header.eaie:apiHeader.correlationId = Environment.Variables.Generic.Session.CorrelationId;
        SET OutputRoot.SOAP.Header.eaie:apiHeader.scrSystem = 'EAI';
        SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
        RETURN TRUE;
    END;
END MODULE;

in breakpoint between [Compute Node] & [SOAP Reply] in message is filled SOAP with correct parameters, but in response is still see only soap body with no header.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>

What I'm missing?


Solution

  • I finally found a solution, I didn't created XMLNSC and didn't add SOAP Body which is mandatory.

    Final code:

    CREATE FUNCTION Main() RETURNS BOOLEAN
        BEGIN
            SET OutputRoot.MQMD = InputRoot.MQMD;
            CREATE LASTCHILD OF OutputRoot DOMAIN 'XMLNSC' NAME 'XMLNSC';
            SET OutputRoot.SOAP.Header.eaie:apiHeader.messageId = UUIDASCHAR;
            SET OutputRoot.SOAP.Header.eaie:apiHeader.timestamp = CURRENT_TIMESTAMP;
            SET OutputRoot.SOAP.Header.eaie:apiHeader.transactionId = Environment.Variables.Generic.Session.TransactionId;
            SET OutputRoot.SOAP.Header.eaie:apiHeader.correlationId = Environment.Variables.Generic.Session.CorrelationId;
            SET OutputRoot.SOAP.Header.eaie:apiHeader.scrSystem = 'EAI';
            SET OutputRoot.SOAP.Body.nsOut:getXXXResponse = InputRoot.XMLNSC.nsOut:getXXXResponse;
            SET OutputRoot.XMLNSC = InputRoot.XMLNSC;
            RETURN TRUE;
        END;
    END MODULE;