使用 JAX-WS wsimport 创建的 Web 服务在 AIX tomcat 上失败
我有一个 jar 文件,其中包含用于连接到我们的基础设施 Web 服务的客户端代码,该服务最初是使用 axis 的 wsdl2java 创建的。本周我对连接的内部结构进行了转换,以使用 wsimport 中的摘录。当使用 java6_18 在我的本地 Windows XP tomcat 上运行时,没有任何问题,并且一切运行正常。我现在已将代码移至我们的开发 AIX 实例,并且在收到以下错误时丢失了全部 Web 服务通信:
XML reader error: javax.xml.stream.XMLStreamException:
The root element is required in a well-formed document
在 AIX 上,我们正在运行 java6_64。
我假设这是 AIX java 库与 Sun 提供的 java 运行时库不兼容,但目前我完全不知道如何解决。
有人能解释一下为什么我会收到此异常吗?
I have a jar file which houses client code to connect to our infrastructure webservices that was initially created using axis' wsdl2java. I converted the guts of the connectivity this week to use the extract from wsimport. When running on my local Windows XP tomcat using java6_18 I have no issues and all runs perfectly. I have now moved my code to our development AIX instance and have lost total web service communication while receiving the following error:
XML reader error: javax.xml.stream.XMLStreamException:
The root element is required in a well-formed document
On AIX we are running java6_64.
I am assuming it is the AIX java libs not being compatible with the Sun provided java runtime libs however I am at a total loss at the moment as to how to resolve.
Can anybody shed some light on why I am receiving this exception?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能是一个代码页问题,因为它抱怨没有根元素,并且如果
<
字符被误解为其他内容,则您没有根元素。检查系统属性以查看程序运行时使用的编码。您可能会假设某个地方的编码是 ISO-Latin-1,就像 Windows 下一样。
This could be a code page issue as it complains that there is no root-element, and if the
<
character is misinterpreted as something else you have no root element.Check the system properties to see what encoding the program runs under. You may have an assumption somewhere that the encoding is ISO-Latin-1 as under Windows.
我不喜欢回答自己的问题,但认为记录答案可能对其他人有益...
经过一番挖掘,解决方案只是 wsdl url 的格式。对于 axis,我将 wsdl URL 指定为 Web 服务的路径。对于 JAX-WS,它需要服务路径+“?wsdl”(运行时加载的实际 wsdl)。
生成上述错误是因为“axis”路径没有导致要拉取的 wsdl,而是导致空白结果集。一旦我添加了“?wsdl”,一切正常。
I don't like answering my own question but thought recording the answer could be beneficial to others...
After digging a bit, the resolution was simply the format of the wsdl url. With axis, I specified the wsdl URL as the path to the webservice. For JAX-WS, it requires path to the service+"?wsdl" (the actual wsdl to load at runtime).
The above error was generated since the "axis" path did not result in the wsdl to pull but rather a blank resultset. Once I added the "?wsdl" all works fine.