0

次の問題の解決策をしばらくの間見つけようとしました。複数 (6) の xsd インポートを含む wsdl ファイルがあります。これらの xsd はプロジェクトの外部にあるため、変更できません。これらのスキーマのうち 2 つでわずかに異なる定義がされている 4 つの定義があります。「競合する」各 xsd スキーマを独自のパッケージに変換しようとしていました。次のバインディングを試しましたが、うまくいきませんでした:

testbindings.jaxb:

<bindings xmlns="http://java.sun.com/xml/ns/jaxb" version="2.1">
    <bindings schemaLocation="a.xsd">
         <schemaBindings>
               <package name="org.wsi.a" />
         </schemaBindings>
    </bindings>
</bindings>

使用:wsimport -p org.wsi -b testbindings.jaxb broker.wsdl

すべてのクラスは で生成され、 ではクラスは生成されorg.wsiませんorg.wsi.a。-p スイッチを指定しないと、すべての xsd が独自のデフォルト パッケージで生成されます。しかし、xsd ごとに特定のパッケージを使用するように wsimport に指示できませんでした。現時点では、次のバインディング ファイルを使用しています。これはおそらく正しくありませんが、wsimport は文句を言いません。

<?xml version="1.0"?>
<jaxws:bindings xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:xsd="http://www.w3.org/2001/XMLSchema"              xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">

<jaxws:bindings wsdlLocation="broker.wsdl" node="wsdl:definitions/wsdl:types/xsd:schema">

    <jaxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" node="//xs:schema/xs:import[@namespace='http://docs.oasis-open.org/wsn/b-2']">>
        <jaxb:schemaBindings>
            <jaxb:package name="org.broker.wsi.b_2"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>

    <jaxb:bindings xmlns:xs="http://www.w3.org/2001/XMLSchema" node="//xs:schema/xs:import[@namespace='http://docs.oasis-open.org/wsn/t-1']">>
        <jaxb:schemaBindings>
            <jaxb:package name="org.broker.wsi.t_1"/>
        </jaxb:schemaBindings>
    </jaxb:bindings>

</jaxws:bindings>

パッケージ org.broker.wsi.b_2 および org.broker.wsi.t_1 では、ファイルは生成されません。

http://docs.oracle.com/cd/E13222_01/wls/docs103/webserv/data_types.html#wp227713で指定されているバインディングを使用しまし たが、おそらく間違っています。

提案は大歓迎です。

4

1 に答える 1

0

wsdl、内部 xsd、および外部 xsd の正しいパッケージ名を設定する問題は、質問/回答で説明されています。

int-bindings.xml ファイル:

<?xml version="1.0"?>
<jaxws:bindings version="2.0"
                xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" 
            xmlns:xsd="http://www.w3.org/2001/XMLSchema"                 
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
            xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
            wsdlLocation="broker.wsdl">

<jaxws:package name="org.broker.wsi" />

<jaxb:bindings node="//xsd:schema">
    <jaxb:schemaBindings>
        <jaxb:package name="org.broker.wsi.al"/>
    </jaxb:schemaBindings>
</jaxb:bindings>

外部バインディング ファイル (省略形):

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

    <jaxb:bindings schemaLocation="http://docs.oasis-open.org/wsn/b-2.xsd" node="//xsd:schema">
            <jaxb:schemaBindings>
                 <jaxb:package name="org.broker.wsi.oasis.b2"/>
            </jaxb:schemaBindings>
    </jaxb:bindings>
</jaxb:bindings>
于 2012-10-04T13:37:25.417 に答える