Just the Headers
How do I change the HTTP status code of the response that is sent back when using a one-way contract?
The result of using a one-way contract is to automatically send back an empty HTTP response when the service method is called. Sending back this response is independent of executing your service code. This means that the normal method of attaching a message property to set the HTTP status code and other HTTP headers can't be applied. There is no reply channel waiting for you to set up a message with the appropriate properties.
However, there is another mechanism for sending back an empty HTTP response where you do have control over the HTTP headers. When you're using the standard request-reply contract with HTTP, you can manipulate the HTTP message that gets sent back for the reply. On that message you can put an HttpResponseMessageProperty that has SuppressEntityBody set to true. SuppressEntityBody produces equivalent messages to a one-way contract that have HTTP headers but no body contents.
You should think of one-way messages and empty messages as having the same appearance but different semantics during processing. The other way around the problem is to find a lower processing layer to apply your HTTP headers. If you get below the processing layer that knows about one-way messaging, then one-way messages and empty messages are not distinguishable. It is the processing layer that recognizes the one-way protocol that creates the distinction.
Next time: Binary Encodings and Addressing
Comments
Anonymous
May 31, 2007
The comment has been removedAnonymous
May 31, 2007
Hey! Call Close on your client proxy objects once you're done using them! This is always a good idea,Anonymous
May 31, 2007
The HTTP verb isn't really significant here because the client gets to pick the verb (could be anything) whereas the server is the one deciding not to send a body with the response. A lot of SOAP processing is done with POST instead of GET so switching to one-way doesn't affect that.Anonymous
June 01, 2007
The comment has been removedAnonymous
June 01, 2007
The comment has been removed