How to create JAXWS web service server skeletons from wsdl ( not in IDE)

﹥>﹥吖頭↗ 提交于 2019-12-06 09:26:48

In addition to client side classes, wsimport also generates a SEI (Service Endpoint Interface). All you need to do is creating an implementation for that.

Then it should be ready for deployment in your application server.

Answer extended:

If you are using Metro, this is a tutorial on how to map your SEI and SIB (Service Implementation Bean) to the config files and get it ready for deployment.

You can do this using wsdl2j during build phases using maven or ant. Also quite good is the cxf codegen plugin for maven.

schnatterer

As pointed out by kevin, this can be done with cxf. They also maintain a maven plugin.

Here's an example on how to generate a server side implementation skeleton:

<plugin>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-codegen-plugin</artifactId>
    <version>2.7.7</version>
    <executions>
        <execution>
            <id>generate-sources</id>
            <phase>generate-sources</phase>
            <configuration>
                <sourceRoot>src/main/gen</sourceRoot>
                <wsdlOptions>
                    <wsdlOption>
                        <wsdl>src/main/webapp/WEB-INF/wsdl/yourWsdl.wsdl
                        </wsdl>
                        <wsdlLocation>classpath:wsdl/yourWsdl.wsdl</wsdlLocation>
                        <!--  Generate WS impl Skeleton -->
                        <extraargs>
                            <extraarg>-impl</extraarg>
                        </extraargs>
                    </wsdlOption>
                </wsdlOptions>
            </configuration>
            <goals>
                <goal>wsdl2java</goal>
            </goals>
        </execution>
    </executions>
</plugin>

The -impl option will create a skeleton impl class that provides a basic implementation for your @WebService interface on the server side (provider). Note that this also create a Service class (consumer/client side).

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!