JD.
JD.

Reputation: 15531

NetDispatcherFaultException error when returning escaped xml

I have a soap web service where the response body contains some escaped xml. So in the body of the response I have :

 <soap:Body>
   <GetServiceResponse xmlns="http://www.abc.com/x/">
        <GetServiceResult>
           <Result>
              <Value>&amp;lt;/param&amp;gt; etc....</Value>
           </Result>
        </GetServiceResult>
     </GetServiceResponse>
 </soap:Body>

On my client I get an exception NetDispatcherFaultException "formatter threw an exception while trying to deserialize". I am using on the client the following code:

 var binding = new BasicHttpBinding();
 var address = new EndpointAddress("http://localhost:2948/ReportingService.asmx");
 ReportingServiceSoap service = new ReportingServiceSoapClient(binding, address);
 var response = service.GetConfig(request); <-- Exception raised on call

If I replace the escaped text with some string value (no escaped xml) then the client does not raise the exception.

Any ideas where to look?

JD

Upvotes: 1

Views: 2016

Answers (1)

JD.
JD.

Reputation: 15531

With Exceptions turned on I found it was a ReadQuotas issue. In addition, I was testing the client interface from mSpec which meant the app.config was not being read with the corrected ReadQuotas values. So in code I have:

var binding = new BasicHttpBinding();
binding.ReaderQuotas.MaxStringContentLength = 2147483647;
binding.ReaderQuotas.MaxArrayLength = 2147483647;
binding.ReaderQuotas.MaxDepth = 2147483647;
binding.ReaderQuotas.MaxNameTableCharCount = 2147483647;
binding.ReaderQuotas.MaxBytesPerRead = 2147483647;

This resolved the issue.

Upvotes: 3

Related Questions