I am facing issue while adding the soap header elements in the backend SOAP service.
Here are my requirement.
1) I will get below request from the requester.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:cus="http://xxxxx.com/CustomUI" xmlns:data="http://www.xxxxxx.com/xml/Account%20-%20Receive%20SAP%20Customer%20(4x%20IDOC%20Input)/Data">
<soapenv:Body>
</soapenv:Body>
</soapenv:Envelope>
2) But I have to add SOAP headers in the request while calling to backend like this
<soapenv:Header>
<SessionType xmlns="http://xxxxxx,com/webservices">Stateful</SessionType>
<UsernameToken xmlns="http://xxxxx.com/webservices">IF_SAP</UsernameToken>
<PasswordText xmlns="http://xxxxx.com/webservices">if_sap_T</PasswordText>
</soapenv:Header>
3) https://techdocs.broadcom.com/us/en/ca-enterprise-software/layer7-api-management/api-gateway/9-4/policy-assertions/assertion-palette/message-validation-transformation-assertions/add-or-remove-xml-element-s-assertion.html
4) Issue is when we pass <soapenv:Header> </soapenv:Header> in the request my API works but there is limitation from requester side they can't send the empty header. hence I tried to add empty header and throwing below error.
20220303 18:44:52.818 WARNING 8803 Unable to insert element because the new element was not a well-formed XML fragment
How can we add this to the request .
Release :
Component :
To be able to add a header it needs to match the defined schema
Use the following context variable value to add the Header to your soap request using the add-or-remove-xml-element-s-assertion
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<SessionType xmlns="http://xxxxx.com/webservices">Stateful</SessionType>
<UsernameToken xmlns="http://xxxxx.com/webservices">IF_SAP</UsernameToken>
<PasswordText xmlns="http://xxxxx. com/webservices">if_sap_T</PasswordText>
</soapenv:Header>