SOAP在体内重新声明qname [英] SOAP re-declaring qname inside body

查看:192
本文介绍了SOAP在体内重新声明qname的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这种形式的SOAP请求:

I have a SOAP request of this form:

<soapenv:Envelope 
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:myqname="http://example.com/hello" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header/>
   <soapenv:Body>
      <myqname:MyRequest xmlns:myqname="http://example.com/hello">
         ...
      </myqname:MyRequest>
   </soapenv:Body>
</soapenv:Envelope>

如果我要求SOAPUI格式化XML此请求,则
会删除第二个声明的myqname,因此得到以下信息:

If I ask SOAPUI to "Format XML" this request, it removes the second declaration of myqname, so I get this:

<soapenv:Envelope 
      xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
      xmlns:myqname="http://example.com/hello" 
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <soapenv:Header/>
   <soapenv:Body>
      <myqname:MyRequest>
         ...
      </myqname:MyRequest>
   </soapenv:Body>
</soapenv:Envelope>

原始请求运行正常,
,但是应用程序服务器对此进行了修改后的请求失败错误:

The original request works fine, but the Application Servers fails with the modified request with this error:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Client</faultcode>
         <faultstring>Unmarshalling Error: UndeclaredPrefix: Cannot resolve 'myqname:MyRequest' as a QName: the prefix 'myqname' is not declared.</faultstring>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

根据网络服务规范,
是强制要求重新命名qname的-在soapenv:Body节点内声明?
这是SOAPUI错误还是Application Server错误?还是我误会了?

According to the web services specification, is it mandatory for the qname to be re-declared inside the soapenv:Body node? Is this a SOAPUI bug, or an Application Server bug? or a misunderstanding from my part?

SOAPUI 4.0.1,WebLogic Server版本:10.3.2.0

SOAPUI 4.0.1, WebLogic Server Version: 10.3.2.0

编辑:ups,即使使用WebLogic应用程序服务器,我也在使用CXF Web服务框架。我在这里发布了问题。 issues.apache.org/jira/browse/CXF-4026

ups, even if using WebLogic application server, I was using the CXF web services framework. I posted the issue there. issues.apache.org/jira/browse/CXF-4026

因此:SOAPUI 4.0.1,CXF 2.5.0

So: SOAPUI 4.0.1, CXF 2.5.0

推荐答案

我将其描述为剥离SOAP信封的代码中的错误;它应该保留名称空间上下文,但实际上并没有这样做,这破坏了XML。我猜这是因为它通过采用子字符串来进行剥离,而不是在DOM元素级别上进行操作(是否使用DOM处理来进行剥离是紧要关头)。由于这些内容的嵌套方式,我不确定 是哪个组件在进行剥离,但是我怀疑它是WebLogic ...

I'd describe it as a bug in the code that strips the SOAP envelope; it should preserve the namespace context yet it isn't doing so, and that's breaking the XML. I guess that's because it is doing the stripping by taking a substring rather than operating at the DOM element level (whether or not it's using DOM processing to do the stripping is beside the point). I'm not sure which component is doing that stripping because of the way these things can be nested, but I suspect it's WebLogic…

:我检查了 SOAP规范,它确实不要说主体的内容必须直接声明使用的名称空间(请参见第5.3.1节),尽管它确实说应该使用名称空间。因此,通常的XML名称间隔规则适用-整个SOAP消息只是一个XML文档-这会使WebLogic的行为成为一个错误。

: I've checked the SOAP specification and it does not say that the contents of the body has to directly declare the namespace used (see §5.3.1), though it does say that it SHOULD be namespaced. Because of that, normal XML namespacing rules apply — the whole SOAP message is simply an XML document — and that would make WebLogic's behavior a bug.

这篇关于SOAP在体内重新声明qname的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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