为 HR-XML PositionOpening WSDL 生成 Web 服务代理客户端
我正在尝试使用 Apache Axis2 为 职位空缺 WSDL 由 HR-XML 提供联盟。我正在使用 wsdl2java 命令行工具来生成代理客户端。
命令:
wsdl2java -uri http://ns.hr-xml.org/schemas/org_hr-xml/3_1_1/Services/Web_Services/WSDL/PositionOpening.wsdl -d adb -o hrxml-positionopening
最后,我尝试通过调用 ant jar.all
将生成的类转换为 JAR。不幸的是,它无法正确编译并引发一些错误。我不知道是什么原因。有 100 多个错误,但我在下面显示了顶部出现的前 3 个错误。
E:\axis2-1.5.4\bin\hrxml-positionopening>ant jar.all
Buildfile: build.xml
init:
pre.compile.test:
[echo] Stax Availability= true
[echo] Axis2 Availability= true
compile.src:
[javac] Compiling 3 source files to E:\axis2-1.5.4\bin\hrxml-positionopening\build\classes
[javac] E:\axis2-1.5.4\bin\hrxml-positionopening\src\org\hr_xml\www\_3\ws\PositionOpening_ServiceStub.java:315862: 'else' without 'if'
[javac] else
[javac] ^
[javac] E:\axis2-1.5.4\bin\hrxml-positionopening\src\org\hr_xml\www\_3\ws\PositionOpening_ServiceStub.java:315964: 'else' without 'if'
[javac] } else {
[javac] ^
[javac] E:\axis2-1.5.4\bin\hrxml-positionopening\src\org\hr_xml\www\_3\ws\PositionOpening_ServiceStub.java:315718: 'try' without 'catch' or 'finally'
[javac] try {
[javac] ^
有人可以解释一下吗?我的目的是将此持仓 WSDL 转换为 JAR,以便我可以直接从应用程序中使用/调用这些函数。
编辑:
同时,我什至尝试使用 JAX-WS 的 wsimport
工具,但命令本身失败。
E:\jdk1.6.0\bin>wsimport.exe -d hrxml-positionopening http://ns.hr-xml.org/schemas/org_hr-xml/3_1_1/Services/Web_Services/WSDL/PositionOpening.wsdl
error: Property "Type" is already defined.
line 1473 of http://ns.hr-xml.org/schemas/org_openapplications_platform/1_1/Common/OAGi/Components/Components.xsd
error: The following location is relevant to the above error
line 1480 of http://ns.hr-xml.org/schemas/org_openapplications_platform/1_1/Common/OAGi/Components/Components.xsd
error: com.sun.istack.internal.SAXParseException2: The following location is relevant to the above error
I'm trying to generate Java web service proxy client using Apache Axis2 for Position Opening WSDL provided by HR-XML Consortium. I'm using wsdl2java
command-line tool to generate proxy client.
Command:
wsdl2java -uri http://ns.hr-xml.org/schemas/org_hr-xml/3_1_1/Services/Web_Services/WSDL/PositionOpening.wsdl -d adb -o hrxml-positionopening
Finally, I then try to convert the generated classes into JAR by calling ant jar.all
. Unfortunately, it is failing to compile properly and throwing some errors. I don't know what the reasons are. There are more than 100 errors, but I have shown below the first 3 errors that appear at the top.
E:\axis2-1.5.4\bin\hrxml-positionopening>ant jar.all
Buildfile: build.xml
init:
pre.compile.test:
[echo] Stax Availability= true
[echo] Axis2 Availability= true
compile.src:
[javac] Compiling 3 source files to E:\axis2-1.5.4\bin\hrxml-positionopening\build\classes
[javac] E:\axis2-1.5.4\bin\hrxml-positionopening\src\org\hr_xml\www\_3\ws\PositionOpening_ServiceStub.java:315862: 'else' without 'if'
[javac] else
[javac] ^
[javac] E:\axis2-1.5.4\bin\hrxml-positionopening\src\org\hr_xml\www\_3\ws\PositionOpening_ServiceStub.java:315964: 'else' without 'if'
[javac] } else {
[javac] ^
[javac] E:\axis2-1.5.4\bin\hrxml-positionopening\src\org\hr_xml\www\_3\ws\PositionOpening_ServiceStub.java:315718: 'try' without 'catch' or 'finally'
[javac] try {
[javac] ^
Can somebody throw some light on this? My purpose is to convert this Position Opening WSDL into a JAR, so that I can use/call the functions directly from within my application.
EDIT:
Meantime, I even tried with wsimport
tool of JAX-WS, but it is failing at the command itself.
E:\jdk1.6.0\bin>wsimport.exe -d hrxml-positionopening http://ns.hr-xml.org/schemas/org_hr-xml/3_1_1/Services/Web_Services/WSDL/PositionOpening.wsdl
error: Property "Type" is already defined.
line 1473 of http://ns.hr-xml.org/schemas/org_openapplications_platform/1_1/Common/OAGi/Components/Components.xsd
error: The following location is relevant to the above error
line 1480 of http://ns.hr-xml.org/schemas/org_openapplications_platform/1_1/Common/OAGi/Components/Components.xsd
error: com.sun.istack.internal.SAXParseException2: The following location is relevant to the above error
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我已经设法使用 JAX-WS 的
wsimport
工具找到了失败的原因。来自 HR-XML 和 Java 文档,原因及其解决方法解释如下:然而,我仍然不知道为什么在尝试使用 ant 构建 JAR 时 Apache Axis2 失败。
I've managed to find the reason why it was failing with
wsimport
tool of JAX-WS. From HR-XML and Java documentation, reason and its work around is explained as shown below:However, still I don't have any idea/answer on why it was failing with Apache Axis2 while trying to build JAR using ant.
我能够通过在调用 wsimport“wsimport -b binding.xml ...”时指定此绑定文件来使其工作
(请注意,我的本地有架构,因此必须更改 Components.xsd 的 schemaLocation在下面的 xml 中)
I was able to make it work by specifying this binding file in my call to wsimport "wsimport -b binding.xml ..."
(Note that I had the schemas on my local so the schemaLocation for Components.xsd would have to be changed in the xml below)