There is an issue when adding the soap header elements in the backend SOAP service. Here are the requirements:
1) Get the below request from the requester
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://example.com/CustomUI" xmlns:data="http://www.example.com/xml/Account%20-%20Receive%20SAP%20Customer%20(4x%20IDOC%20Input)/Data">
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
2) Add SOAP headers in the request while calling to the backend
<soapenv:Header>
<SessionType xmlns="http://example.com/webservices">Stateful</SessionType>
<UsernameToken xmlns="http://example.com/webservices">IF_SAP</UsernameToken>
<PasswordText xmlns="http://example.com/webservices">if_sap_T</PasswordText>
</soapenv:Header>
3) https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-gateway/11-0/policy-assertions/assertion-palette/message-validation-transformation-assertions/add-or-remove-xml-element-s-assertion.html
4) When passing <soapenv:Header> </soapenv:Header> in the request, the API works but there is limitation from requester side. They can't send an empty header. When trying to add an empty header, an error occurs:
20220303 18:44:52.818 WARNING 8803 Unable to insert element because the new element was not a well-formed XML fragment
How can a header be added to this request?
All supported versions of the API Gateway
To be able to add a header, it needs to match the defined schema. Use the Add or Remove XML Element(s) assertion to add the Header to the SOAP request.
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<SessionType xmlns="http://example.com/webservices">Stateful</SessionType>
<UsernameToken xmlns="http://example.com/webservices">IF_SAP</UsernameToken>
<PasswordText xmlns="http://example.com/webservices">if_sap_T</PasswordText>
</soapenv:Header>