lundi 1 février 2016

Handling WCF REST request without namespace using c#

I have a WCF REST service that I need to expose to a client. The service works fine when I unit-test it, but when I use the client's real-life sample, I get 400 Bad Request. The difference between my unit test's request and the actual client's is the namespace. In my unit test i supply the namespace, such as:

<OuterTag xmlns="http://ift.tt/1P0jA8t" xmlns:i="http://ift.tt/ra1lAU">
  <InnerTag1>theId</InnerTag1>
  <InnerTag2>theName</InnerTag2>
  <InnerTag3>theTotal</InnerTag3>
  <InnerTag4>theAdditionalInfo</InnerTag4>
</OuterTag>

whereas the real-life request is without namespace as follows:

<OuterTag>
  <InnerTag1>theId</InnerTag1>
  <InnerTag2>theName</InnerTag2>
  <InnerTag3>theTotal</InnerTag3>
  <InnerTag4>theAdditionalInfo</InnerTag4>
</OuterTag>

Is there a way my service can cater for the requests without namespace? I have tried IDispatchMessageInspector but it doesn't work.

Thanks.

Aucun commentaire:

Enregistrer un commentaire