Detailed graph Description: java-based webservice Programming

Source: Internet
Author: User

Step 1, create a webservice project, select the JAX-WS [Note: this example uses IDE for MyEclipse]
 

Step 2: create a service class
[Java]
Package com. xjtu. webservice;
 
/**
*
*
* <P>
* Title: Test code/p>
*
* <P>
* Description: example business class
* </P>
*
* <P>
* Copyright: Copyright (c) 2012
* </P>
*
* @ Author dml @ 2012-12-11
* @ Version 1.0
*/
Public class MobileNumInfo {
Public String getMobileNum (){
Return "13888888888 ";
}
}

Step 3: Release the Web Service. Select the project you just created, and choose Create Web service from Java class from strategy.

 


Step 4: generate the WSDL


Step 5, add the library file [JAX-WS *]

 

 

Step 6: start Tomcat


Step 7: Open your browser and enter the address
Step 8: Create a client test project and select java project.

Step 9: generate the library file required by WS

 

 

Step 10: Compile the test program and view the execution result
[Java]
Package com. xjtu. webservice. test;
 
Import com. xjtu. webservice. MobileNumInfoDelegate;
Import com. xjtu. webservice. MobileNumInfoService;
 
/**
*
*
* <P>
* Title: Test code/p>
*
* <P>
* Description: example business class
* </P>
*
* <P>
* Copyright: Copyright (c) 2012
* </P>
*
* @ Author dml @ 2012-12-11
* @ Version 1.0
*/
Public class MobileNumTest {
Public static void main (String [] args ){
MobileNumInfoService mnis = new MobileNumInfoService ();
MobileNumInfoDelegate mnid = mnis. getMobileNumInfoPort ();
System. out. println (mnid. getMobileNum ());
}
}

Execution result:
[Plain]
13888888888


P.s. The process is actually not difficult, and you can master it by yourself.
Pp. s. The temperature drops sharply. You should pay more attention to adding clothes to keep warm ~~ As long as you do not get sick, it is happiness.
Ppp. s. in this world, "the only thing that is unstoppable is time. It is like a blade, silently cutting everything hard and soft and moving forward steadily, nothing can make its progress bumpy, but it changes everything."
 

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.