1

I am developing a WCF service which is called by third party. They have a requirement that WCF service should send an empty response with HTTP status code 200. I have a void method and response contain SOAP envelope with empty body. But they are saying that response should be blank. I tried making the service OneWay but then status code is 202 not 200. Is there a way to achieve this?

<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>
        <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
            <u:Timestamp u:Id="_0">
                <u:Created>2020-07-02T16:07:55.708Z</u:Created>
                <u:Expires>2020-07-02T16:12:55.708Z</u:Expires>
            </u:Timestamp>
        </o:Security>
    </s:Header>
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"/>
</s:Envelope>
Chamal
  • 1,439
  • 10
  • 15
  • 1
    What do you mean by empty response? Is there no soap message or no content in SOAP message. I think the IDispatchMessageInspector interface should be able to help you. IDispatchMessageInspector can process the messages to be sent. – Ding Peng Jul 09 '20 at 08:48
  • No soap message. I implemented IDispatchMessageInspector interface. When reply is set to null I can achieve blank response without soap envelope. However with that change HTTP status code changes to 202. Client expects 200 status code. – Chamal Jul 10 '20 at 05:50
  • As far as I know, we cannot set the reply to null, because the client will check the structure of the received SOAP message, maybe you can consider using webhttpbinding. – Ding Peng Jul 19 '20 at 05:11

1 Answers1

0

Considering that you say you have solved the empty message issue and you are dealing with the HTTP Status on response, maybe this Answer : How can I return a custom HTTP status code from a WCF REST method? can help you

Mauricio Ortega
  • 301
  • 2
  • 12