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

我们两清 提交于 2019-12-08 00:49:41

问题


i can't find any where how to create web service from server skeletons ( java pojo's )from wsdl using JAXWS. The only tutorials I see are using automated wizard in NetBeans and and axis2 in eclipse. Can someone please give me hints on how to generate server side classes from given wsdl?

Thanks

UPADATE:
I just need to do :
wsimport.bat -Xendorsed SOAP.WSDL
and it creates the artifacts. But now how do I implement it in the server ?


回答1:


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.




回答2:


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




回答3:


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).



来源:https://stackoverflow.com/questions/7662236/how-to-create-jaxws-web-service-server-skeletons-from-wsdl-not-in-ide

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