为 HR-XML PositionOpening WSDL 生成 Web 服务代理客户端

发布于 2024-11-16 12:37:56 字数 2384 浏览 3 评论 0原文

我正在尝试使用 Apache Axis2 为 职位空缺 WSDLHR-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 技术交流群。

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

发布评论

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

评论(2

与往事干杯 2024-11-23 12:37:56

我已经设法使用 JAX-WS 的 wsimport 工具找到了失败的原因。来自 HR-XML 和 Java 文档,原因及其解决方法解释如下:

JAX-WS 无法处理由 HR-XML 联盟提供的 HR-XML WSDL 和 XSD。模式或 Web 服务定义没有错误,但 JAX 处理引擎不支持所采用的模式和目录结构。这是 JAX-WS 的一个限制,希望在未来的版本中得到纠正。要解决这些问题,必须进行以下更改。

文件中的属性类型
org_openapplications_platform\1_1\Common\OAGi\Components\components.xsd
必须重命名才能生成代码。

然而,我仍然不知道为什么在尝试使用 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:

JAX‐WS cannot process the supplied HR‐XML WSDLs and XSDs as supplied by the HR‐XML Consortium. There are no errors with the schemas or web service definitions, but the patterns and directory structures employed are not supported by the JAX processing engine. This is a limitation of JAX‐WS that will hopefully be rectified in future versions. To work around these issues, the following changes must be made.

The attribute type in file
org_openapplications_platform\1_1\Common\OAGi\Components\components.xsd
must be renamed for code generation.

However, still I don't have any idea/answer on why it was failing with Apache Axis2 while trying to build JAR using ant.

Saygoodbye 2024-11-23 12:37:56

我能够通过在调用 wsimport“wsimport -b binding.xml ...”时指定此绑定文件来使其工作

(请注意,我的本地有架构,因此必须更改 Components.xsd 的 schemaLocation在下面的 xml 中)

<jxb:bindings 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    version="2.1">

    <!-- Raise theEnumMemberSizeCap limit -->
    <jxb:bindings>
        <jxb:globalBindings typesafeEnumMaxMembers="2000"/>
    </jxb:bindings>


    <jxb:bindings schemaLocation="DataQuery_wsdl/Components.xsd" version="1.0">
        <!-- Customise the package name -->
        <!--<schemaBindings>
            <package name="com.example.schema"/>
        </schemaBindings>-->

        <!-- rename the value element -->
        <jxb:bindings node="//xsd:complexType[@name='ContactType']">
            <jxb:bindings node=".//xsd:attribute[@name='type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='DocumentReferenceType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='ClassificationType']">
            <jxb:bindings node=".//xsd:attribute[@name='type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='ImageAttachmentType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='OpenAttachmentType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='SpecificationType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='EventType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='QualifiedAmountType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='TermABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='DimensionABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='CurrencyExchangeBaseType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='ProjectABIEType']">
            <jxb:bindings node=".//xsd:attribute[@name='type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='AddressBaseType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='TaxABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='AllowanceChargeABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='LocationABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

    </jxb:bindings>   


</jxb:bindings>

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)

<jxb:bindings 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
    version="2.1">

    <!-- Raise theEnumMemberSizeCap limit -->
    <jxb:bindings>
        <jxb:globalBindings typesafeEnumMaxMembers="2000"/>
    </jxb:bindings>


    <jxb:bindings schemaLocation="DataQuery_wsdl/Components.xsd" version="1.0">
        <!-- Customise the package name -->
        <!--<schemaBindings>
            <package name="com.example.schema"/>
        </schemaBindings>-->

        <!-- rename the value element -->
        <jxb:bindings node="//xsd:complexType[@name='ContactType']">
            <jxb:bindings node=".//xsd:attribute[@name='type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='DocumentReferenceType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='ClassificationType']">
            <jxb:bindings node=".//xsd:attribute[@name='type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='ImageAttachmentType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='OpenAttachmentType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='SpecificationType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='EventType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='QualifiedAmountType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='TermABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='DimensionABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='CurrencyExchangeBaseType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='ProjectABIEType']">
            <jxb:bindings node=".//xsd:attribute[@name='type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='AddressBaseType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='TaxABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='AllowanceChargeABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

        <jxb:bindings node="//xsd:complexType[@name='LocationABIEType']">
            <jxb:bindings node=".//xsd:element[@ref='Type']">
                <jxb:property name="TypeAttribute"/>
            </jxb:bindings>
        </jxb:bindings>

    </jxb:bindings>   


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