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