如何使用ckpython发送Mtom请求

2024-10-03 13:26:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我想发出这样的请求

"--MIMEBoundaryurn_uuid_CBA6AA33B04D4FE290C78EDC27692044
Content-Type:  application/xop+xml; charset=UTF-8; type="application/soap+xml"
Content-Transfer-Encoding: binary
Content-ID: <0.urn:uuid:25D7275EEDB74CD38330E1099799A99B@ws.jboss.org>

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:a="http://www.w3.org/2005/08/addressing"`enter code here`
            xmlns:s="http://www.w3.org/2003/05/soap-envelope">
   <s:Header>
      <a:Action s:mustUnderstand="1"></a:MessageID>
      <a:ReplyTo>
         <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
      </a:ReplyTo>
      <a:To s:mustUnderstand="1"></a:To>
   </s:Header>
   <s:Body>
      <xdsb:RetrieveDocumentSetRequest xmlns:lcm="urn:oasis:names:tc:ebxml-regrep:xsd:lcm:3.0"
                                       xmlns:rim="urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0"
                                       xmlns:rs="urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0"
                                       xmlns:xdsb="urn:ihe:iti:xds-b:2007"
                                       xmlns:xop="http://www.w3.org/2004/08/xop/include">
         <xdsb:DocumentRequest>
            <xdsb:HomeCommunityId/>
            <xdsb:RepositoryUniqueId>1.1.4567332.1.11</xdsb:RepositoryUniqueId>
            <xdsb:DocumentUniqueId>1.3.6.1.4.1.12559.11.20.1.107116118052107102.1571060804</xdsb:DocumentUniqueId>
         </xdsb:DocumentRequest>
      </xdsb:RetrieveDocumentSetRequest>
   </s:Body>
</s:Envelope>"

我正在使用此代码发送我的mtom请求,但它给出了一个错误 “在消息正文中找不到多部分边界[--MIMEBoundaryurn_uuid_CBA6AA33B04D4FE290C78EDC27692044]。” 有人能帮我一下吗。谢谢

success = xml.LoadXmlFile(myxmlfile)
strXml = xml.getXml()
http.SetRequestHeader("Content-Type", "application/xop+xml; charset=UTF-8; type=application/soap+xml")
http.SetRequestHeader("Content-Type","multipart; boundary=MIMEBoundaryurn_uuid_CBA6AA33B04D4FE290C78EDC27692044; charset=utf-8")
http.SetRequestHeader("Content-Transfer-Encoding", "binary")
http.SetRequestHeader("Content-ID","<0.urn:uuid:25D7275EEDB74CD38330E1099799A99B@ws.jboss.org>")

Tags: orghttpuuidapplicationwwwxmlcontentxmlns