gpt4 book ai didi

.net - Soap 响应,格式不正确的 XML,未找到 XOP 部件,使用 WSE

转载 作者:数据小太阳 更新时间:2023-10-29 01:56:10 25 4
gpt4 key购买 nike

我正在使用一个 Web 服务,在该服务中我发送了一个带有附件的请求,我们从服务器收到了包含各种信息的响应。我在另一个问题 Adding an attachment to SOAP request 中记录了将请求放在一起的一些问题,但这一点已经解决,现在另一个问题出现在响应中。

我们收到响应正常,但抛出错误:

Response is not well-formed XML.

InnerException 是:

WSE1608: No XOP parts were located in the stream for the specified content-id: <rootpart*36875c60-630c-4e23-9e74-f9a9c7547fc7@example.jaxws.sun.com>

返回的 xml 如下所示:

--uuid:36875c60-630c-4e23-9e74-f9a9c7547fc7
Content-Type: application/xop+xml;charset=utf-8;type="text/xml";
Content-ID: <rootpart*36875c60-630c-4e23-9e74-f9a9c7547fc7@example.jaxws.sun.com>
content-transfer-encoding: binary

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<payloadManifest xmlns="http://(namespace)">
<manifest contentID="content0" element="ProcessAttachment" namespaceURI="http://(namespace)" version="2.01"/>
</payloadManifest>
</soapenv:Header>
<soapenv:Body>
<tran:ProcessMessageResponse xmlns="http://(namespace)" xmlns:ns2="http://(ns2Namespace)" xmlns:ns3="http://(ns3Namespace)" xmlns:tran="http://(tranNamespace)">
<tran:payload>
<tran:content id="content0">
<s:ShowServiceProcessingAdvisory xmlns:s="http://(sNamespace)">
<s:ApplicationArea>
<s:Sender>
<s:Component>Global Warranty Management</s:Component>
<s:Task>ShowAttachments</s:Task>
<s:CreatorNameCode>Creator</s:CreatorNameCode>
<s:SenderNameCode>GM</s:SenderNameCode>
</s:Sender>
<s:CreationDateTime>2012-01-10T12:58:27Z</s:CreationDateTime>
<s:Destination>
<s:DestinationNameCode>XX</s:DestinationNameCode>
<s:DealerNumber>234567</s:DealerNumber>
<s:DealerCountry>US</s:DealerCountry>
</s:Destination>
</s:ApplicationArea>
<s:DataArea>
<s:Show/>
<s:ServiceProcessingAdvisory>
<s:Header>
<s:SecondaryDealerNumber>253909</s:SecondaryDealerNumber>
<s:Disposition>
<s:RepairOrder>
<s:WarrantyClaim xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:WarrantyClaimExtended">
<s:OEMClaimNumber>00112233445566778899</s:OEMClaimNumber>
<gwm:Attachment xmlns:gwm="http://(gwmNamespace)">
<gwm:AttachmentId>5678987</gwm:AttachmentId>
<gwm:Filename>14.jpg</gwm:Filename>
</gwm:Attachment>
</s:WarrantyClaim>
</s:RepairOrder>
</s:Disposition>
</s:Header>
</s:ServiceProcessingAdvisory>
</s:DataArea>
</s:ShowServiceProcessingAdvisory>
</tran:content>
</tran:payload>
</tran:ProcessMessageResponse>
</soapenv:Body>
</soapenv:Envelope>

--uuid:36875c60-630c-4e23-9e74-f9a9c7547fc7--

我假设这是由于 MIME 部分造成的错误,但应该如何处理?

我可以补充一点,这是在 SoapUI 中返回的完全相同的 XML,并且是预期返回的 XML。另外,我可能会补充说需要 WSE 有两个原因,因为 Web 服务的第三方开发人员拒绝更改他们的工作方法,而且我们还依赖 VS 2005,因此无法使用 WCF,尤其是在截止日期前悬在我们头上。

编辑:我收到的实际回复如下,为了便于阅读,我在上面设置了格式

HTTP/1.1 200 OK
Date: Mon, 16 Jan 2012 09:44:22 GMT
Server: ACE XML Gateway
Cache-Control: no-cache="Set-Cookie"
Set-Cookie: JSESSIONID=h3LnPTxYdZJ3wp4zFl2GV3BYQ7fZD1p8WbvPgl1Qq95g1F9GQhMC!1396094632; path=/
X-Powered-By: Servlet/2.5 JSP/2.1
Content-Type: multipart/related; type="application/xop+xml"; boundary="uuid:a9a94e4e-5134-4995-8884-dfd4d65b7784"; start="<rootpart*a9a94e4e-5134-4995-8884-dfd4d65b7784@example.jaxws.sun.com>"; start-info="text/xml"
Content-Length: 2296
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive


--uuid:a9a94e4e-5134-4995-8884-dfd4d65b7784
Content-Type: application/xop+xml;charset=utf-8;type="text/xml";
Content-ID: <rootpart*a9a94e4e-5134-4995-8884-dfd4d65b7784@example.jaxws.sun.com>
content-transfer-encoding: binary

<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><payloadManifest xmlns="http://www.starstandards.org/webservices/2005/10/transport"><manifest contentID="content0" element="ProcessAttachment" namespaceURI="http://www.starstandards.org/STAR" version="2.01"/></payloadManifest></soapenv:Header><soapenv:Body><tran:ProcessMessageResponse xmlns="http://www.starstandards.org/STAR" xmlns:ns2="http://www.gm.com/2006/GWM" xmlns:ns3="http://www.starstandards.org/webservices/2005/10/transport" xmlns:tran="http://www.starstandards.org/webservices/2005/10/transport"><tran:payload><tran:content id="content0"><s:ShowServiceProcessingAdvisory xmlns:s="http://www.starstandards.org/STAR"><s:ApplicationArea><s:Sender><s:Component>Global Warranty Management</s:Component><s:Task>ShowAttachments</s:Task><s:CreatorNameCode>General Motors</s:CreatorNameCode><s:SenderNameCode>GM</s:SenderNameCode></s:Sender><s:CreationDateTime>2012-01-16T09:44:24Z</s:CreationDateTime><s:Destination><s:DestinationNameCode>XX</s:DestinationNameCode><s:DealerNumber>253909</s:DealerNumber><s:DealerCountry>US</s:DealerCountry></s:Destination></s:ApplicationArea><s:DataArea><s:Show/><s:ServiceProcessingAdvisory><s:Header><s:SecondaryDealerNumber>253909</s:SecondaryDealerNumber><s:Disposition><s:RepairOrder><s:WarrantyClaim xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:WarrantyClaimExtended"><s:OEMClaimNumber>001116695583</s:OEMClaimNumber><gwm:Attachment xmlns:gwm="http://www.gm.com/2006/GWM"><gwm:AttachmentId>5677606</gwm:AttachmentId><gwm:Filename>1127.jpg</gwm:Filename></gwm:Attachment></s:WarrantyClaim></s:RepairOrder></s:Disposition></s:Header></s:ServiceProcessingAdvisory></s:DataArea></s:ShowServiceProcessingAdvisory></tran:content></tran:payload></tran:ProcessMessageResponse></soapenv:Body></soapenv:Envelope>

--uuid:a9a94e4e-5134-4995-8884-dfd4d65b7784--

最佳答案

我不知道这是否是创建帖子时的疏忽,但如果响应确实在 <?xml?> 之前有两个空格声明,那么就是语法错误。如果出现 xml 声明,它必须是文档中的第一件事,其他任何东西(甚至空格)都不能放在第一位。

http://www.w3.org/TR/REC-xml/#sec-prolog-dtd

删除那些空格,文档看起来格式正确,所以我不知道它会是什么。

关于.net - Soap 响应,格式不正确的 XML,未找到 XOP 部件,使用 WSE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8805095/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com