带有 AXIS 服务器的 JAX-WS 客户端; 响应中缺少命名空间
我遇到与 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要编写一个不包含名称空间的自定义 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.