1

I am trying to customize the soap header in Mule 3.7. By default using the web-service-consumer I get the following:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" soap:mustUnderstand="1">
        <wsse:UsernameToken wsu:Id="UsernameToken-6CF0E33EE8AA1E3DB414700278333141">
            <wsse:Username>TEST/wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText"/>
        </wsse:UsernameToken>
    </wsse:Security>
</SOAP-ENV:Header>

However, I would like to change the SOAP header to be:

<soap:Header>
<Security xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <UsernameToken>
        <Username>TEST</Username>
    </UsernameToken>
</Security>

Where in Mule do I need to add the below?

<set-property propertyName="soap.Authorization"
value="<auth>Bearer MWYxMDk4ZDktNzkyOC00Z</auth>"/>

Does the above need to be added in the ws:consumer-config below?

<ws:consumer-config name="WSConsumerConfig" wsdlLocation="${wsdl.location}"
service="aService" port="aServiceHttpPort" serviceAddress="${service.url}"
connectorConfig="HTTPRequestConfig" doc:name="Web Service Consumer">

max
  • 53
  • 8

1 Answers1

2

I have fixed by adding a message-property-transformer just before the call to the ws-consumer:

<message-properties-transformer doc:name="Message Properties">
                <add-message-property key="soap.header" value="${web.service.username.token}"/>
            </message-properties-transformer>
max
  • 53
  • 8