WCF - I have been given a SOAP request and I need to create a SOAP web service to consume this SOAP request

77 Views Asked by At

The sample SOAP request will come through like this:

<soapenv:Envelope xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope>
    <soapenv:Header xmlns:wsa=http://www.w3.org/2005/08/addressing>
        <wsse:Security xmlns:wsse=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd soapenv:mustUnderstand="0">
            <wsse:UsernameToken xmlns:wsu=http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd wsu:Id="UsernameToken-1">
                    <wsse:Username>soapUserName</wsse:Username>
            </wsse:UsernameToken>
        </wsse:Security>
        <wsa:To>https://wcfexample.com/Service.svc</wsa:To>
        <wsa:MessageID>ABC123</wsa:MessageID>
        <wsa:Action>SoapRQ</wsa:Action>
    </soapenv:Header>
    <soapenv:Body>
    <ABC>
        <DETAIL>
            ...
        </DETAIL>
    </ABC>
    </soapenv:Body>
</soapenv:Envelope>

The Body of the soap envelope is xml, which I think would be best handled as a string and then I can serialise this once it hits the server.

I think the trickiest thing for me is setting up the configuration of WCF to handle the security portion of this.

Any help with this would be greatly appreciated.

1

There are 1 best solutions below

2
Jiayao On

The wcf setting security section usually selects the binding you want, then sets a security mode for the binding, and on the client side you can also set the client credential type. You can refer to the docs for more info.