Hi,
I'm developing a WCF service and the QA department is using Soap UI to invoke methods and send test data. They have reported an error when using an ampersand character in a text field of the request.
Offers.API.Infrastructure.Handlers.ServiceErrorHandler.ProvideFault|notauth::
The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://namesapce.net/api/offers:model.
The InnerException message was 'There was an error deserializing the object of type Offers.TransportModel.OfferModel.
Unexpected end of file. Following elements are not closed: Description, OfferDescriptionModel, Conditions, model, CreateOffer, Body, Envelope. Line 353, position 20.'.
The request they are sending from SOAP UI looks something like this...
<off:Conditions>
<off:OfferDescriptionModel>
<off:CultureFormat></off:CultureFormat>
<off:CultureInvariantId>0</off:CultureInvariantId>
<off:Description>QA API & Added Value 15</off:Description>
<off:IsInvariant>true</off:IsInvariant>
</off:OfferDescriptionModel>
</off:Conditions>
* If they properly encode the ampersand in SOAP UI, then no error occurs.
* When calling the service from a proxy generated by svcutil, characters are properly encoded and no error occurs.
My Issue:
The error returned isn't the greatest - I'd prefer it to handle a bit more gracefully.
I cannot guarantee how the clients consuming the service are going to be generating their requests - so there's nothing I can do in terms of setting encoding etc on the request. I can only handle in the service.
Question(s):
* Is there anything I can do to help WCF when deserializing content that may not be properly encoded? Is there a simple service setting I'm missing?
If WCF could automagically handle all encoding service side for me, great.
Otherwise, any other options appreciated.
Thanks