wcfsoappython-requestswsdlzeep

How to change the MaxBytesPerRead property on the XmlDictionaryReaderQuotas in Python?


I am trying to send a SOAP request using requests.post and I get the below error.

Content-ID: <http://tempuri.org/0>
Content-Transfer-Encoding: 8bit
Content-Type: application/xop+xml;charset=utf-8;type="text/xml"

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <s:Fault>
         <faultcode xmlns:a="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher">
             a:DeserializationFailed
         </faultcode>
         <faultstring xml:lang="en-AU">
             The formatter threw an exception while trying to 
             deserialize the message: There was an error while trying to deserialize parameter 
             http://tempuri.org/:Data. The InnerException message was 'There was an error 
             deserializing the object of type 
             System.Collections.Generic.List`1[[Blue.Integration.IDataRow, Blue.Integration, 
             Version=7.20.1.56190, Culture=neutral, PublicKeyToken=null]]. The 'maximum bytes per Read 
             operation' quota (4096) has been exceeded while reading XML data. Long element start tags 
             (consisting of the element name, attribute names and attribute values) may trigger 
             this quota. 
             This quota may be increased by changing the MaxBytesPerRead property on the 
             XmlDictionaryReaderQuotas object used when creating the XML reader. Line 71, position 
             48.'.  
             Please see InnerException for more details.
          </faultstring>
      </s:Fault>
   </s:Body>
</s:Envelope>

The provider of the service has told me that I should follow the instructions on this link.

Is this something that requests cannot do? Should I be using zeep? In either case an example in Python where MaxBytesPerRead property is changed on the XmlDictionaryReaderQuotas would be very helpful. Thanks!


Solution

  • This error comes from the provider of the service, they should adjust the MaxBytesPerRead in their BasicHttpBinding within the web.config. The there is nothing you can do about in the calling service on your end.