0
votes

This is existing header

<s:Header>
  <ActivityId xmlns="http://schemas.microsoft.com/2004/09/ServiceModel/Diagnostics" CorrelationId="10018d27-2573-4d6b-8bcb-b49f6c686f1a">5d827c1d-bd7b-437f-904f-5f82c9844022</ActivityId>
 </s:Header>    

I need to add following security in header part using enrich mediator

<o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
     <o:UsernameToken u:Id="uuid-05a278f7-0f00-4710-b81c-4401fd280d6d-3">
        <o:Username>FISEPAY_DEV</o:Username>
        <o:Password>RaDrup5E4awreP</o:Password>
     </o:UsernameToken>
  </o:Security>

So how i need to add using enrich mediator

2

2 Answers

0
votes

Try using the below code.

   <enrich>
 <source type="inline" clone="true">
            <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
         <o:UsernameToken u:Id="uuid-05a278f7-0f00-4710-b81c-4401fd280d6d-3">
            <o:Username>FISEPAY_DEV</o:Username>
            <o:Password>RaDrup5E4awreP</o:Password>
         </o:UsernameToken>
      </o:Security>
  </source>
            <target xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
                    xpath="//<s:Header>"/>
         </enrich>
    <log level="full"/>
0
votes

Use the property mediator as below ,

 <property name="test" expression="get-property('registry','conf:/test.xml')" scope="default" type="OM" />

conf:/test.xml should be the path where your xml is stored.

Now this variable "test" can be used in enrich mediator.