0

コントラクトを最初に作成したいSpring webservice。WSDL ファイルはありますが、WSDL から Spring Web サービスを生成する例が見つかりません。

この Maven プラグインを使用して生成できますが、Spring WebService ではなく J2EE WebService になりますよね?:

<plugin>
    <groupId>org.jvnet.jax-ws-commons</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <configuration>
        <xdebug>true</xdebug>
        <verbose>true</verbose>
        <target>2.0</target>
    </configuration>
    <executions>
        <execution>
            <id>generate-service</id>
            <goals>
                <goal>wsimport</goal>
            </goals>
            <configuration>
                <wsdlDirectory>src/main/resources/wsdls</wsdlDirectory>
                <wsdlFiles>
                    <wsdlFile>service.wsdl</wsdlFile>
                </wsdlFiles>
                <sourceDestDir>target/generated-code/src</sourceDestDir>
            </configuration>
        </execution>
    </executions>
</plugin>

これにより、 @WebServiceアノテーションを持つインターフェースが生成されます。しかし、これJ2EEアプリケーション用であり、Spring 用ではありませんよね?

それで、すでに書かれたWSDLファイルからSpring WebServicesを生成するためのmavenのツールはありますか?

何も見つからないため、jaxws-Maven-plugin だけです。

4

1 に答える 1

1

You can surely use :

http://cxf.apache.org/docs/maven-cxf-codegen-plugin-wsdl-to-java.html

or http://www.mojohaus.org/jaxb2-maven-plugin/Documentation/v2.2/example_xjc_basic.html

or even https://java.net/projects/maven-jaxb2-plugin/pages/Home

Then you'll just have to create a jaxws:client in spring : http://cxf.apache.org/docs/jax-ws-configuration.html

Or just the cxf component in camel : http://camel.apache.org/cxf.html

J2EE is nothing more than a stack, a collection of framework that forms a collection. You can use CXF/Spring with another Framework (such as OSGi) and just import what interests you (for example, camel-cxf, spring-core, ...). For example, I'm working on an OSGi environment, but we are using codegen plugin to generate the class and then integrate them with camel-cxf.

于 2016-03-22T20:30:54.340 に答える