【问题标题】:JAX-B Global Binding Ignored in WSDLWSDL 中忽略的 JAX-B 全局绑定
【发布时间】:2012-07-03 21:49:15
【问题描述】:

我有一个 WSDL,我从它在 NetBeans 中生成类。未更改的副本具有日期,这些日期生成为 XMLGregorianCalendar。我试图覆盖该行为并插入一个全局绑定标记,以便它生成一个 Java 日期。但是,无论我将绑定标签(如下所示)放在哪里,它都会被忽略,并且使用 XMLGregorianCalendar 作为日期类型。

谁能告诉我我是否在正确的轨道上,以及在哪里放置覆盖?下面也是WSDL的整体布局。

<annotation>
    <appinfo>
        <jaxb:globalBindings>
            <javaType name="java.util.Date" xmlType="xs:date"
                      parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
                      printMethod="javax.xml.bind.DatatypeConverter.printDate"
        </jaxb:globalBindings>
    </appinfo>
</annotation>

经过编辑的 WSDL,显示了我认为的相关部分:

<types>
    <s:schema xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:sap="http://xyz/sap" elementFormDefault="qualified" targetNamespace="http://xyz/sap">
        <s:element name="createOrder">
            <s:complexType>
                <s:sequence>
                    <s:element ref="sap:sap-order-request" />
                </s:sequence>
            </s:complexType>
        </s:element>
    </s:schema>

    <xs:schema xmlns:sap="http://xyz/sap" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xyz/sap" elementFormDefault="unqualified">
        <xs:element name="sap-order-request">
            <xs:complexType>
                <xs:sequence minOccurs="1" maxOccurs="unbounded">
                    <xs:element name="publication-date" type="xs:date" />
                </xs:sequence>
            </xs:complexType>
        </xs:element>
    </xs:schema>
</types>

 <binding name="SapSalesOrderSoap" type="s0:SapSalesOrderSoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="createOrder">
        <soap:operation soapAction="http://xyz/sap/createOrder" style="document"/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
</binding>

【问题讨论】:

    标签: java xml web-services jaxb


    【解决方案1】:

    我认为您缺少 &lt;javaType&gt; 元素上的名称空间前缀 - 它需要位于 JAXB 名称空间中,而不是 XML Schema 或 WSDL 名称空间中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2011-11-12
      • 1970-01-01
      • 1970-01-01
      • 2019-11-14
      • 2011-10-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多