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, in the OrderTshirt:\soapkit-config flow, click Transform Message.

  3. Edit the DataWeave code to get the API key, which is an header property:

    %dw 2.0
    output application/java
    ns ns0
          body : {
             ns0#OrderTshirtResponse: {
               orderId: "I got a request from "
               ++ " using the following auth header "
               ++ (payload.headers["AuthenticationHeader"].ns0#AuthenticationHeader.apiKey default "")
        } write "application/xml"
  4. Save and rerun the project.

  5. In SoapUI, send a request to the OrderTshirt endpoint, and check that the response appears as follows:

    <soap:Envelope xmlns:soap="">
          <ns0:OrderTshirtResponse xmlns:ns0="">
             <orderId>I got a request from John, using the following auth header 987654321</orderId>

Was this article helpful?

💙 Thanks for your feedback!

Edit on GitHub
Give us your feedback!
We want to build the best documentation experience for you!
Help us improve with your feedback.
Take the survey!