在 Web 服务请求中将字符串内容编码为 XML
我正在处理一个问题,必须使用从 WSDL 开发的遗留 Web 服务客户端,该客户端将实际的 XML 请求作为请求中唯一一个变量的值传递。我现在使用的 Web 服务具有不同的 WSDL,我试图欺骗我的 XML 解析器,但它正在对我的实际 XML 响应进行编码。
无论如何,是否可以配置解析器,以便将请求:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<request><elemA><elemB>abc</elemB></elemA></request>
</soapenv:Body>
</soapenv:Envelope>
更改为:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<foo>
<elemA>
<elemB>abc</elemB>
</elemA>
</foo>
</soapenv:Body>
</soapenv:Envelope>
我正在使用 JAX-WS 和 WebSphere 7。
提前致谢。
巴勃罗
I am dealing with a problem where I must use a legacy web services client developed from a WSDL that passes in the actual XML request as the value of the only one variable in the request. The web service that I am consuming now has a different WSDL and I am trying to trick my XML parser however it is encoding my actual XML response.
Is there anyway to configure the parser so the request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<request><elemA><elemB>abc</elemB></elemA></request>
</soapenv:Body>
</soapenv:Envelope>
is changed into this:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header/>
<soapenv:Body>
<foo>
<elemA>
<elemB>abc</elemB>
</elemA>
</foo>
</soapenv:Body>
</soapenv:Envelope>
I am using JAX-WS and WebSphere 7.
Thanks in advance.
Pablo
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
去年我曾经处理过这种情况,我的解决方案是将肥皂消息中的 XML 包装在 CDATA 部分中。
I had to deal with this situation once last year, the solution for me was to wrap the XML that was going inside the soap message inside a CDATA section.