JAX-WS Writing WebService

Source: Internet
Author: User

1. Create a new Web project

2. Create a class to publish

 PackageCom.linjian.webservice;ImportJavax.jws.WebMethod;ImportJavax.jws.WebParam;ImportJavax.jws.WebResult;ImportJavax.jws.WebService; @WebService (ServiceName= "Hello", targetnamespace= "http://www.joinhealth.cn") Public classHello {@WebMethod @WebResult (name= "Output")     PublicString SayHello (@WebParam (name= "Input") (String name) {return"Hello" +name; }}
ServiceName specifying the service name
TargetNamespace specifying the WebService namespace
@ WEBRESULT specifies that the participating
@WebParam The specified entry
3, the Web project into a jar package, there is a Export-->jar file
4. In the Axis2\web-inf directory, create a new folder Servicejars, put the jar package generated in the previous step into this folder
Axis2.xml
<Deployerextension= ". Class"Directory= "Pojo"class= "Org.apache.axis2.deployment.POJODeployer"/><Deployerextension= ". Jar"Directory= "Servicejars"class= "Org.apache.axis2.jaxws.framework.JAXWSDeployer"/><Deployerextension= ". Jar"Directory= "Transports"class= "Org.apache.axis2.deployment.TransportDeployer"/>
5, start Tomcat, access to WSDL will be error, the solution:
Copy Tools.jar from JDK Lib to Tomcat Lib or Axis2 Lib
6. Start Tomcat

JAX-WS Writing WebService

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.