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.
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:Description>QA API & Added Value 15</off:Description>
* 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.