开发者

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


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜