验证 MTOM 消息时出错:解析消息以进行验证时出错“消息第一部分不是文本/xml”

问题描述

我正在尝试通过 MTOM(从 c# 使用 httpRequest 类)调用 SOAP 网络服务。 这适用于非 MTOM 服务,但在调用 MTOM 服务时出现以下错误

<l7:assertionResult assertion="l7p:MTOMValidateAssertion" status="Bad Request">
  <l7:detailMessage id="8965">Error validating MTOM message: Error parsing message for validation 'Message first part is not text/xml'</l7:detailMessage>
</l7:assertionResult>

我知道某些 MTOM 服务在消息格式方面非常严格。但是,我看不出有什么问题。我要发送的消息是

--MIME_Boundary
Content-Type: application/xop+xml; type="text/xml"; charset=UTF-8
Content-transfer-encoding: 8bit
Content-ID: <[email protected]>

<soapenv:Envelope xmlns:v3="http://contracts.coolprofs.nl/plato/platoservice/v3/" xmlns:v31="http://schemas.coolprofs.nl/plato/platoservicetypes/v3/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Header />
  <soapenv:Body>
    <v3:aanmakenDocumentEnMetagegevens>
      <v3:registratiegegevens>
        <v31:onderwerp>ExamplePDF</v31:onderwerp>
        <v31:documenttype>PDF</v31:documenttype>
        <v31:documentstatus>Definitief</v31:documentstatus>
      </v3:registratiegegevens>
      <v3:bestand>
        <inc:Include href="cid:1001" xmlns:inc="http://www.w3.org/2004/08/xop/include" />
      </v3:bestand>
    </v3:aanmakenDocumentEnMetagegevens>
  </soapenv:Body>
</soapenv:Envelope>

--MIME_Boundary
Content-Type: application/pdf
Content-transfer-encoding: binary
Content-ID: <1001>
Content-disposition: attachment; name="MyPDF.pdf"

....<binarydata>......
--MIME_Boundary--

这是 POST webrequest 的 Content-Type

multipart/related; type="application/xop+xml"; start="<[email protected]>"; start-info="text/xml"; boundary="MIME_Boundary"

非常感谢您的帮助!

问候, 米歇尔

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)