通过处理程序使用 JAX-RPC 或 XSLT-ing 响应进行类型化
所以我们已经有了一个可爱的老式 PHP WS,我们必须通过 JAX-RPC 集成,这个 WS 提供一些响应,如下所示:
<return SOAP-ENC:arrayType="SOAP-ENC:Array[1]" xsi:type="SOAP-ENC:Array">
<item SOAP-ENC:arrayType="xsd:ur-type[3]" xsi:type="SOAP-ENC:Array">
<item xsi:type="xsd:string">...</item>
<item xsi:type="xsd:float">...</item>
<item xsi:type="xsd:int">...</item>
</item>
</return>
现在的问题是,JAX-RPC 似乎不知道 ur-type
code>
我们考虑使用 Handler
来搜索并替换响应的 XML 或通过 XSLT
转换它,以便 ur-type
> => anyType
但我们似乎不知道如何做到这一点。具体来说,我们可以使用什么 OutputStream
/ StreamResult
进行转换?
任何其他建议都非常受欢迎:)
So we've got ourselves a lovely vintage PHP WS we must integrate via JAX-RPC and this WS delivers some responses as follows:
<return SOAP-ENC:arrayType="SOAP-ENC:Array[1]" xsi:type="SOAP-ENC:Array">
<item SOAP-ENC:arrayType="xsd:ur-type[3]" xsi:type="SOAP-ENC:Array">
<item xsi:type="xsd:string">...</item>
<item xsi:type="xsd:float">...</item>
<item xsi:type="xsd:int">...</item>
</item>
</return>
Now the problem is, JAX-RPC doesn't seem to know about ur-type
We thought about using a Handler
for doing a search and replace on the the responses' XML or transforming it via XSLT
so that ur-type
=> anyType
but we can't seem to figure it out how to do it. Specifically what OutputStream
/ StreamResult
could we use for the transformation?
Any other suggestion is more than welcomed :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因此,如果最终我们放弃了使用
XSLT
或搜索并替换原始XML
的想法。我们使用
SOAPBody
来操作响应的DOM
并将ur-type
替换为anyType
,一切顺利很好。尽管如此,如果您有更好的想法,请发布。编辑:这就是我们基本上是如何做到的。
这在您获取端口的类中,您需要注册进行搜索和替换的处理程序:
处理程序如下所示:
So if the end we gave up with our idea of using a
XSLT
or doing a search and replace on the rawXML
.We're using
SOAPBody
to manipulate the responses'DOM
and replaceur-type
withanyType
and everything works out just fine. Nonetheless, if you have any better idea, please do post it.Edit: here's how we basically did it.
This goes in the class where you get the port, you need to register the handler where you do your search and replace:
And this is how the handler looks like: