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