SOAP响应,没有良好的XML,没有XOP部件的位置,使用WSE [英] Soap response, not well formed XML, no XOP parts located, using WSE

查看:312
本文介绍了SOAP响应,没有良好的XML,没有XOP部件的位置,使用WSE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我消费中,我发送了一个请求一个带有附件的Web服务,我们从服务器接收各种信息的响应。我记录了一些问题得到请求另一个问题添加附件的SOAP请求和< /一>,但该位已经解决,现在另一个问题也随之而来,对响应。

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

  

反应不是格式良好的XML。

设置InnerException是:

  

WSE1608:没有XOP部分分别位于流为指定内容ID的:其中,rootpart*36875c60-630c-4e23-9e74-f9a9c7547fc7@example.jaxws.sun.com>

这将返回看起来像XML:

   -  UUID:36875c60-630c-4e23-9e74-f9a9c7547fc7
内容类型:应用程序/ XOP + XML;字符集= UTF-8; TYPE =为text / xml;
内容ID:&LT; rootpart*36875c60-630c-4e23-9e74-f9a9c7547fc7@example.jaxws.sun.com>
内容传输编码:二进制

  &LT; XML版本=1.0编码=UTF-8&GT?;
  &LT; soapenv:信封XMLNS:S =htt​​p://schemas.xmlsoap.org/soap/envelope/的xmlns:soapenv =htt​​p://schemas.xmlsoap.org/soap/envelope/&GT;
    &LT; soapenv:头的xmlns:soapenv =htt​​p://schemas.xmlsoap.org/soap/envelope/&GT;
      &LT; payloadManifest的xmlns =HTTP://(空间)&GT;
        &LT;舱单内容ID =content0元素=ProcessAttachment的namespaceURI =HTTP://(空间)版本=2.01/&GT;
      &LT; / payloadManifest&GT;
    &LT; / soapenv:头&GT;
    &LT; soapenv:身体与GT;
      &LT; TRAN:ProcessMessageResponse的xmlns =HTTP://(空间)的xmlns:NS2 =HTTP://(ns2Namespace)的xmlns:NS3 =HTTP://(ns3Namespace)的xmlns:TRAN =HTTP:/ /(tranNamespace)&GT;
        &LT; TRAN:有效载荷GT;
          &LT; TRAN:内容ID =content0&GT;
            &LT; S:ShowServiceProcessingAdvisory的xmlns:S =HTTP://(sNamespace)&GT;
              &所述氏:ApplicationArea&GT;
                &LT; S:发送&GT;
                  &LT; S:成分&gt;全球保修管理和LT; / S:成分&gt;
                  &LT; S:任务&GT; ShowAttachments&LT; / S:任务&GT;
                  &LT; S:CreatorName code&GT;的创造者和LT; / S:CreatorName code取代;
                  &LT; S:发送者姓名code取代; GM&LT; / s的:发送者姓名code取代;
                &LT; / S:发送&GT;
                &LT; S:CreationDateTime&GT; 2012-01-10T12:58:27Z&LT; / S:CreationDateTime&GT;
                &LT; S:目的地&GT;
                  &LT; S:DestinationName code&GT; XX&LT; / S:DestinationName code取代;
                  &所述氏:DealerNumber&GT; 234567&所述; /秒:DealerNumber&GT;
                  &LT; S:DealerCountry&GT;美国&LT; / S:DealerCountry&GT;
                &LT; / S:目的地&GT;
              &所述; /秒:ApplicationArea&GT;
              &所述氏:DataArea&GT;
                &LT; S:显示/&GT;
                &所述氏:ServiceProcessingAdvisory&GT;
                  &LT; S:头&GT;
                    &所述氏:SecondaryDealerNumber&GT; 253909&所述; /秒:SecondaryDealerNumber&GT;
                    &LT; S:处置&GT;
                      &所述氏:RepairOrder&GT;
                        &LT; S:WarrantyClaim的xmlns:XSI =htt​​p://www.w3.org/2001/XMLSchema-instance的xsi:type =NS2:WarrantyClaimExtended&GT;
                          &所述氏:OEMClaimNumber&GT; 00112233445566778899&所述; /秒:OEMClaimNumber&GT;
                          &LT;长城汽车:附件的xmlns:GWM =HTTP://(gwmNamespace)&GT;
                            &LT;长城汽车:附件ID&GT; 5678987&LT; /长城汽车:附件ID&GT;
                            &LT;长城汽车:文件名&GT; 14.JPG&LT; /长城汽车:文件名&GT;
                          &LT; /长城汽车:附件&GT;
                        &所述; /秒:WarrantyClaim&GT;
                      &所述; /秒:RepairOrder&GT;
                    &LT; / S:处置&GT;
                  &LT; / S:头&GT;
                &所述; /秒:Ser​​viceProcessingAdvisory&GT;
              &所述; /秒:DataArea&GT;
            &所述; /秒:ShowServiceProcessingAdvisory&GT;
          &LT; / TRAN:内容&GT;
        &LT; / TRAN:有效载荷GT;
      &LT; / TRAN:ProcessMessageResponse&GT;
    &LT; / soapenv:身体与GT;
  &LT; / soapenv:信封&GT;

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

我假设这是一个错误,由于MIME部分,但应该如何来处理呢?

可能我只想补充一点,这是了SoapUI返回完全相同的XML和是预期返回的XML。另外,我想补充一点,WSE需要2个原因,因为Web服务的第三方开发商拒绝改变其工作方法,而且我们也对VS 2005的依赖,因此无法使用WCF,espaecially的截止日期笼罩着我们。

编辑:我收到的实际响应低于,我格式化它上面为了便于阅读

  HTTP / 1.1 200 OK
日期:星期一,2012 9时44分22秒格林尼治标准​​时间01月16日
服务器:ACE XML网关
缓存控制:无缓存=设置Cookie
设置Cookie:JSESSIONID = h3LnPTxYdZJ3wp4zFl2GV3BYQ7fZD1p8WbvPgl1Qq95g1F9GQhMC 1396094632; PATH = /
的X已启动方式:的Servlet / JSP 2.5 / 2.1
内容类型:多部分/相关; TYPE =应用程序/ XOP + XML;边界=UUID:a9a94e4e-5134-4995-8884-dfd4d65b7784;开始=&其中; rootpart*a9a94e4e-5134-4995-8884-dfd4d65b7784@example.jaxws.sun.com>;启动信息=为text / xml
内容长度:2296
保持活动:超时= 15,最大= 100
连接:保持活动


--uuid:a9a94e4e-5134-4995-8884-dfd4d65b7784
内容类型:应用程序/ XOP + XML;字符集= UTF-8; TYPE =为text / xml;
内容ID:&LT; rootpart*a9a94e4e-5134-4995-8884-dfd4d65b7784@example.jaxws.sun.com>
内容传输编码:二进制

&LT; XML版本=1.0编码=UTF-8&GT?;
&LT; soapenv:信封XMLNS:S =htt​​p://schemas.xmlsoap.org/soap/envelope/的xmlns:soapenv =htt​​p://schemas.xmlsoap.org/soap/envelope/&GT;&LT; soapenv :头的xmlns:soapenv =htt​​p://schemas.xmlsoap.org/soap/envelope/&GT;&LT; payloadManifest的xmlns =htt​​p://www.starstandards.org/webservices/2005/10/transport&GT; &LT;舱单内容ID =content0元素=ProcessAttachment的namespaceURI =htt​​p://www.starstandards.org/STAR version="2.01"/></payloadManifest></soapenv:Header><soapenv:Body><tran:ProcessMessageResponse的xmlns =htt​​p://www.starstandards.org/STAR的xmlns:NS2 =htt​​p://www.gm.com/2006/GWM的xmlns:NS3 =htt​​p://www.starstandards.org/webservices / 2005/10 /传输 xmlns:tran="http://www.starstandards.org/webservices/2005/10/transport"><tran:payload><tran:content的id =content0&GT;&所述氏:ShowServiceProcessingAdvisory xmlns:s="http://www.starstandards.org/STAR"><s:ApplicationArea><s:Sender><s:Component>Global保证Management</s:Component><s:Task>ShowAttachments</s:Task><s:CreatorName$c$c>General Motors</s:CreatorName$c$c><s:SenderName$c$c>GM</s:SenderName$c$c></s:Sender><s:CreationDateTime>2012-01-16T09:44:24Z</s:CreationDateTime><s:Destination><s:DestinationName$c$c>XX</s:DestinationName$c$c><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 =htt​​p://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 code中的2号线。例如,如果你正在使用的JavaScript你会

这一切需要你收到响应之后要做,你解析为XML之前

如果你不使用JavaScript,你可以通过使用正则表达式做同样的

在更糟糕的情况下,如果您的环境不支持任何事情,我说,你可以去一个旧的方式:逐行读取,当你第一次发现一个&LT;作为第一个字符,保存该行,读多了一个和停止。

I am consuming a web service in which I send off a request with an attachment and we receive a response from the server with various information. I have documented some problems with getting the request together in another question Adding an attachment to SOAP request but this bit has been resolved and now another problem has cropped up on the response.

We receive the response ok but an error is thrown stating:

Response is not well-formed XML.

The InnerException is:

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

The xml that is returned looks like:

--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--

I'm assuming this is an error due to the MIME parts, but how should this be handled?

Might I just add that this is the exact same XML returned in SoapUI and is the expected returned XML. Also, I might add that WSE is required for 2 reasons, because the third party developer of the web service refuses to change their working methods, and we also have a reliance on VS 2005 and therefore can't utilise WCF, espaecially with a deadline hanging over us.

EDIT: The actual response I receive is below, I formatted it above for ease of reading

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--

解决方案

you can make use of string operators to just extract the 2 lines containing xml code. for instance if you are using javascript you would

all of this needs to be done after you receive response and before you parse it as xml

if you don't use javascript you can do the same by using regexp

in the even worse case, if your environment doesn't support any of the things i said, you can go for an old way: read line by line , when you first find a "<" as first character, save that line, read one more and stop.

这篇关于SOAP响应,没有良好的XML,没有XOP部件的位置,使用WSE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆