簡體   English   中英

如何更改 Python 中 XmlDictionaryReaderQuotas 的 MaxBytesPerRead 屬性?

[英]How to change the MaxBytesPerRead property on the XmlDictionaryReaderQuotas in Python?

我正在嘗試使用requests.post發送 SOAP 請求,但出現以下錯誤。

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>

服務提供商告訴我,我應該按照此鏈接上的說明進行操作。

這是requests不能做的事情嗎? 我應該使用zeep嗎? 在任何一種情況下,Python 中的一個示例都會非常有幫助,其中在XmlDictionaryReaderQuotas上更改了MaxBytesPerRead屬性。 謝謝!

此錯誤來自服務提供者,他們應該在 web.config 中調整其 BasicHttpBinding 中的 MaxBytesPerRead。 在您的呼叫服務中,您無能為力。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM