SOAP Headers in Enhanced Webreference with WS Security

  

Im trying to use the enhanced webreference api to consume a soap service. i need to construct the soap header 

Im adding the following to the the Soapheader Element.

============================================

Request1.

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">

    <s:Header>

        <h:ophalenWaardesOpzoektabelHeader

            xmlns="https://wsgateway.ot.denhaag.nl/wsplato/platoservice/v2"

            xmlns:h="http://contracts.denhaag.nl/plato/platoservice/v2/"

            xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

            <h:authenticatie>

                <gebruikersnaam xmlns="http://schemas.denhaag.nl/plato/platoservicetypes/v2/">XXXXX</gebruikersnaam>

                <wachtwoord xmlns="http://schemas.denhaag.nl/plato/platoservicetypes/v2/">XXXXX</wachtwoord>

                <bibliotheek xmlns="http://schemas.denhaag.nl/plato/platoservicetypes/v2/">XXXXX</bibliotheek>

            </h:authenticatie>

            <h:opzoektabelNaam>Richting</h:opzoektabelNaam>

            <ingeschakeld>true</ingeschakeld>

        </h:ophalenWaardesOpzoektabelHeader>

        <o:Security xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">

            <u:Timestamp u:Id="_0">

                <u:Created>"18-09-2018 10:21:06"</u:Created>

                <u:Expires>"18-09-2018 10:26:06"</u:Expires>

            </u:Timestamp>

            <o:UsernameToken u:Id="uuid-e188a2aa-ea5a-4638-972c-a205ec12cccf-1">

                <o:Username>XXXXX</o:Username>

                <o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXX</o:Password>

            </o:UsernameToken>

        </o:Security>

    </s:Header>

    <s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        <ophalenWaardesOpzoektabel xmlns="http://contracts.denhaag.nl/plato/platoservice/v2/"/>

    </s:Body>

</s:Envelope>

==========================

When the service gets called the request looks like the following (with double soap envelopes and body tags.)

========================================

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soap:Header>

<s:Envelope s:mustUnderstand="1"

xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">

<s:Header>

<h:ophalenWaardesOpzoektabelHeader

xmlns="https://wsgateway.ot.denhaag.nl/wsplato/platoservice/v2"

xmlns:h="http://contracts.denhaag.nl/plato/platoservice/v2/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<h:authenticatie>

<gebruikersnaam xmlns="http://schemas.denhaag.nl/plato/platoservicetypes/v2/">XXXXX</gebruikersnaam>

<wachtwoord xmlns="http://schemas.denhaag.nl/plato/platoservicetypes/v2/">XXXXX</wachtwoord>

<bibliotheek xmlns="http://schemas.denhaag.nl/plato/platoservicetypes/v2/">XXXXX</bibliotheek>

</h:authenticatie>

<h:opzoektabelNaam>Richting</h:opzoektabelNaam>

<ingeschakeld>true</ingeschakeld>

</h:ophalenWaardesOpzoektabelHeader>

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

<o:UsernameToken u:Id="uuid-e188a2aa-ea5a-4638-972c-a205ec12cccf-1">

<o:Username>XXXXX</o:Username>

<o:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">XXXXX</o:Password>

</o:UsernameToken>

</o:Security>

</s:Header>

<s:Body xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<ophalenWaardesOpzoektabel xmlns="http://contracts.denhaag.nl/plato/platoservice/v2/"/>

</s:Body>

</s:Envelope>

</soap:Header>

<soap:Body>

<ophalenWaardesOpzoektabel xmlns="http://contracts.denhaag.nl/plato/platoservice/v2/"/>

</soap:Body>

</soap:Envelope>

===============================

How do I construct the soapheader correctly according to the first request.