WebService "Java" __web

Source: Internet
Author: User

Https://www.cnblogs.com/AlanLee/archive/2017/06/02/6933073.html


1, ordinary Java Pro NEW:

Package com.busy.webservice;

Import Javax.jws.WebService;
Import Javax.xml.ws.Endpoint;

@WebService public
class WebServiceTest {public
	string transwords (string words) {
		string res = ' ";
		for (char Ch:words.toCharArray ()) {
			res = + ch + ",";
		}
		return res;
	}
	
	public static void Main (string[] args) {
        //Use Endpoint (Terminal) class to publish WebService
         Endpoint.publish ("http://localhost : 8089/service/webservice ", New WebServiceTest ());
         System.out.println ("Publish Success");
	}

2, can use Test tool test: Storm_r1.1-adarna



3, Java WebService Client, first with the JDK with the Wsimport generated code

Wsimport-s. http://localhost:8089/service/webservice?wsdl


4, new Common Java Pro, the introduction of generated Java files


5, Direct call:

Package com.busy.webservice;

public class Maintest {public

	static void Main (string[] args) {
		webservicetestservice test = new Webservicetestse Rvice ();
		WebServiceTest tes = Test.getport (webservicetest.class);
		String self = tes.transwords ("Wahaha");
		System.out.println (self);
	}



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.