(1) to write an endpoint implementation class, use @ WebService and @ webmethod
(2). Use wsgen to generate the WSDL based on the endpoint implementation class. For example:
C:/Java/jdk1.6.0 _ 11/bin> wsgen-cp d:/eclipse3.5/workspace/jaxb/bin-keep-D: /eclipse3.5/workspace/jaxb/src-r d:/eclipse3.5/workspace/jaxb/conf-wsdl com. abchina. console. hello. hello
Com. abchina. console. hello. generate code in the jaxws package and generate the WSDL in D:/eclipse3.5/workspace/jaxb/CONF.
The method for generating a Java class using WSDL is as follows:
C:/Java/jdk1.6.0 _ 11/bin> xjc-d:/eclipse3.5/workspace/jaxb/src/-p com. abchina. console. helloworld-wsdl d:/eclipse3.5/workspace/jaxb/CONF/helloworld. WSDL-no-Header
(3). Use wsimport to generate portable products from WSDL
C:/Java/jdk1.6.0 _ 11/bin> wsimport-keep-p com. abchina. console. hello-d:/eclipse3.5/workspace/jaxb/src D:/eclipse3.5/workspace/jaxb/CONF/helloservice. WSDL-B D:/eclipse3.5/workspace/jaxb/CONF/helloservice_schema1.xsd
Or C:/Java/jdk1.6.0 _ 11/bin> wsimport-keep-p com. ABC. sample. client-D:/eclipse3.5/workspace/jaxws/src http: // 127.0.0.1: 8080/jaxws/Hello? WSDL-B http: // 127.0.0.1: 8080/jaxws/Hello? XSD = 1
The difference between wsimport and xjc is that wsimport will generate more WebService class and webserviceporttype interfaces.