axis wsdl2java 无法读取带有特殊字符的模式
我正在尝试使用 wsdl2java (由 maven axistools 包装)生成带有轴的 Java 客户端。
我下载了 wsdl 和相应的架构。
wsdl 具有以下模式定义:
<wsdl:types>
<xsd:schema
targetNamespace="http://example.com/CM_IntegrationService/"
xmlns:pref="http://example.com/CM_IntegrationService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://example.com//CM_IntegrationService"
schemaLocation="CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd"/>
简而言之:
schemaLocation="CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd"
错误显示为:
[错误] 无法执行目标 org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java (默认)在项目 wsclient-cm 上:从 WSDL 生成 Java 代码时出错。运行时出错 文件:/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService.wsdl:
WSDLException(位于 /wsdl:definitions/wsdl:types/xsd:schema):faultCode=OTHER_ERROR: 尝试解析引用的架构时发生错误 在“CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd”处,相对于 '文件:/C:/workspace/ws/wsclient-reactor/shop-wsclient-wsdl/src/main/wsdl/CM_IntegrationService.wsdl':
找不到此文件: 文件:/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService?xsd = ServiceModel_CM_IntegrationService.xsd - > [帮助1]
在短文件中找不到:
/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd
有没有办法指定使用哪个架构?我将架构保存为 ServiceModel_CM_IntegrationService.xsd
。但是,它搜索包含 =
和 ?
的完整路径,我无法在文件系统上模拟它们。
我不想按照以下建议修改 wsdl:WSDL 到 Java -client 创建错误 < /一>
<一href="https://stackoverflow.com/questions/4781028/why-is-axistools-maven-plugin-trying-to-access-this-relative-schema-location">为什么 axistools-maven-plugin 尝试访问这个相对架构位置?看起来很相似,但是使用useEmitter=true
选项没有帮助。
I'm trying to generate a Java Client with the axis using wsdl2java
(wrapped by the maven axistools).
I downloaded the wsdl and the corresponding schema.
The wsdl has the following schema definitions:
<wsdl:types>
<xsd:schema
targetNamespace="http://example.com/CM_IntegrationService/"
xmlns:pref="http://example.com/CM_IntegrationService"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:import namespace="http://example.com//CM_IntegrationService"
schemaLocation="CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd"/>
In short:
schemaLocation="CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd"
The error shows as:
[ERROR] Failed to execute goal org.codehaus.mojo:axistools-maven-plugin:1.4:wsdl2java
(default) on project wsclient-cm: Error generating Java code from WSDL. error running
file:/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService.wsdl:WSDLException (at /wsdl:definitions/wsdl:types/xsd:schema): faultCode=OTHER_ERROR:
An error occurred trying to resolve schema referenced
at 'CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd', relative to
'file:/C:/workspace/ws/wsclient-reactor/shop-wsclient-wsdl/src/main/wsdl/CM_IntegrationService.wsdl'.:This file was not found:
file:/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd -> [Help 1]
In short file not found for:
/C:/workspace/ws/wsclient-reactor/wsclient-wsdl/src/main/wsdl/CM_IntegrationService?xsd=ServiceModel_CM_IntegrationService.xsd
Is there a way to specify which schema to use? I saved the schema as ServiceModel_CM_IntegrationService.xsd
. However its searching for the full path including =
and ?
which I cannot emulate on the file system.
I don't want to modify the wsdl as suggested in: WSDL to Java -client creation error
Why is axistools-maven-plugin trying to access this relative schema location? looks similar however using the useEmitter=true
option didn't help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
目前,如果不修改 WSDL,这是不可能的。在不修改 WSDL 的情况下执行此操作(顺便说一句,您为什么不想这样做?)需要支持 XML 目录,如 AXIS-1984。
This is currently not possible without modifying the WSDL. Doing this without modifying the WSDL (BTW, why don't you want to do that?) would require support for XML catalogs, as described in AXIS-1984.