[SOAP Extensibility Samples] Having trouble adding header

Forge Component
(4)
Published on 15 Feb by Pedro Guimarães
4 votes
Published on 15 Feb by Pedro Guimarães

I'm trying to use the 'AddSOAPHeader_ToRequest' function to add a header to my soap request.

However, I'm having a hard time understanding what I need to provide as input to the function to create a header.

With the following SOAP action, what do I fill in to add the authentication header in 'Name', 'Namespace' and 'Value', the input parameters for the function?


<soap:Envelope xmlns:soap="https://www.w3.org/2003/05/soap-envelope" xmlns:com="https://api.company.nl/soap/Service">
   <soap:Header>
      <com:AuthHeader>
         <!--Optional:-->
         <com:Username>?</com:Username>
         <!--Optional:-->
         <com:Token>?</com:Token>
      </com:AuthHeader>
   </soap:Header>
   <soap:Body>
      <com:List_GetAll/>
   </soap:Body>
</soap:Envelope>

Hello,

I currently have the exact same issue. Regardless of what I put in the inputs I always get the error "Object reference not set to an instance of an object."

If anyone could help undestanding what are the correct values to the inputs, I would appreciate.


Hi,

you need to call RegisterInspectHeaders as first thing in OnBeforeRequestAdvanced and then "Object reference not set to an instance of an object." error would dissapear.




@rob knipscheer: Did you got a solution to this problem.  Even I have the same requirement to add user credentials as a part of SOAP Header.  I am getting "Unable to extract the User from the SOAP Header"

---- SOAP Header ---

<SOAP-ENV:Header xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"

                   xmlns:S="https://schemas.xmlsoap.org/soap/envelope/"

                   xmlns:env="https://schemas.xmlsoap.org/soap/envelope/">      

<wsse:Security xmlns:wsse="https://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">

         <wsse:UsernameToken>

            <wsse:Username>myuset@dummy.com</wsse:Username>

            <wsse\:Password>nYRU1FoZ</wsse\:Password>

         </wsse\:UsernameToken>

      </wsse\:Security>

   </SOAP-ENV\:Header>

I have used "AddSOAPHeader_ToRequest" with following parameters:

1. Name:  "Security"

2. Namespace: "https://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"

3. Value: "

         <wsse:UsernameToken>

            <wsse:Username>myuset@dummy.com</wsse:Username>

            <wsse\:Password>nYRU1FoZ</wsse\:Password>

         </wsse\:UsernameToken>

"

----

I have attahced Sample.oml for reference.

Let me know If I am missing anything.

Hi,

There is other plugin which is specifically built to add the wise:security header to SOAP request. I would recommend trying that, this extension mostly provides basic stuff and just a starting point to extend further.

Thanks,

Prasad Rao

@Prasad: thanks for a swift response.  Can you please provide little more details or link to the plugin which you are referring to.

Hi,

WCF WS-Security and WSE Nonce Authentication (https://www.outsystems.com/forge/component-overview/6374/wcf-ws-security-and-wse-nonce-authentication) worked for us

Thanks,

Prasad