How to Use JAX-WS to generate WebService

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.