带有 AXIS 服务器的 JAX-WS 客户端; 响应中缺少命名空间

发布于 2024-07-18 05:57:51 字数 913 浏览 9 评论 0原文

我遇到与 JAX-WS 和 AXIS 相关的问题。 JAX-WS (2.1.7) 作为客户端,Axis (1.4.x) 作为服务器。

一切正常,但无法将响应读取到 Java。

响应:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
  <ns1:myserviceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://my/service">
   <ns1:myserviceReturn xsi:type="xsd:string">responsestring</ns1:myserviceReturn>
  </ns1:myserviceResponse>
 </soapenv:Body>
</soapenv:Envelope>

问题是,如果从 myserviceReturn 中删除 ns1:-namespace 声明,JAX-WS 能够返回 null 以外的任何内容。

有谁知道如何强制 JAX-WS 忽略名称空间,如何手动修改 SOAP 响应以排除“ns1”,或此类问题的其他想法?

I'm having a problem related to JAX-WS and AXIS. JAX-WS (2.1.7) as a client, Axis (1.4.x) as server.

Everything works OK, but the response can't be read to Java.

Response:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <soapenv:Body>
  <ns1:myserviceResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="http://my/service">
   <ns1:myserviceReturn xsi:type="xsd:string">responsestring</ns1:myserviceReturn>
  </ns1:myserviceResponse>
 </soapenv:Body>
</soapenv:Envelope>

The problem is that if ns1:-namespace declaration is removed from myserviceReturn, JAX-WS is able to return anything else than null.

Does anyone have a clue how to force JAX-WS to ignore namespaces, how to modify SOAP response manually to exclude "ns1", or other ideas for this kind of problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青衫儰鉨ミ守葔 2024-07-25 05:57:51

您需要编写一个不包含名称空间的自定义 WSDL 文件。 该文件位于 META-INF 目录中。 您可以从应用程序现在拥有的默认值开始,然后将其保存在此处。

You need to write a custom WSDL file that does not include the name space. This file goes in the META-INF directory. You can start with the default one that your app has now, then save it here.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文