Nav
You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

To Get a SOAP Header

In this procedure, you retrieve a SOAP header from the request. In the SoapUI, the request window shows the soap Envelope header.

apikit-for-soap-53dc2
  1. In the SoapUI, modify the OrderTshirt request by entering a value for the API key. For example, enter 987654321 between the <apiKey> tags.

  2. In Studio, edit the DataWeave code to get the API key, which is an inbound property, from the header:

    
              
           
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    
    %dw 1.0
    %output application/xml
    %namespace ns0 http://mulesoft.org/tshirt-service
    ---
    {
      ns0#OrderTshirtResponse: {
        orderId: "I got a request from "
        ++ payload.ns0#OrderTshirt.name
        ++ ", using the following auth header "
        ++ inboundProperties['soap.AuthenticationHeader'].ns0#AuthenticationHeader.apiKey
      }
    }
  3. Save and rerun the project.

  4. In SoapUI, send a request, and check that the response changes to the following:

    
              
           
    1
    2
    3
    4
    5
    6
    7
    
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <soap:Body>
          <ns0:OrderTshirtResponse xmlns:ns0="http://mulesoft.org/tshirt-service">
             <orderId>I got a request from John, using the following auth header 987654321</orderId>
          </ns0:OrderTshirtResponse>
       </soap:Body>
    </soap:Envelope>

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+