Using MyEclipse 8.5 to develop JAX-WS-Based Web service instances
This article is an introduction to Web service development, mainly introduces the basic process of developing the service Program and client program of Web service in MyEclipse 8.5 environment.
Deploy the Web Service service in WebLogic 10.3.4.
The development environment is as follows:
JAVA ide:myeclipse 8.5
To develop a Web service service program, you need to understand the following related content, WSDL, SOAP, XML. These are the foundations that make up a Web service.
The development of the Web Service program under Myeclipse8.5, there are currently 3 development frameworks supported by the system,
Jax-ws,rest (Jax-rs), XFire. The system does not recommend the use of Xfire framework, may be to be eliminated (deprecated). We chose the JAX-ws framework. This requires the support of Java EE 5.0. Therefore, when you select the Web server container, you should be able to support Java EE 5.0 to deploy successfully.
(i) WEB Service server Development
1. Create a new Web service project, menu file, new, Web service project,
Enter the project name mywebsvc in the box above, the framework chooses Jax-WS, and the Java EE can only be selected for the 5.0.
Finish completing the project new.
2. Create a new Java Bean, which is a normal class, file–> new class,
Next go to the next step,
Choose Create Web Service from Java Class (bottom-up scenario), next to the next step,
Java class input Com.myweb.ws.SayHello, select the Generate WSDL in Project option,
Finish new.
Generate a new service proxy class, com.myweb.ws.SayHelloDelegation
Generate WSDL definition file, webroot\web-inf\wsdl\sayhelloservice.wsdl
Webroot\web-inf\wsdl\sayhelloservice_schema1.xsd,
(ii) Deployment of Web service services
Tomcat 6.0 on deployment, need to add JAX-ws Api/runtime Two libraries, otherwise will error,------------>jar package in the network disk jax-ws2.1.2 directory
Severity: Error Configuring Application Listener of Class Com.sun.xml.ws.transport.http.servlet.WSServletContextListenerjava.lang.ClassNotFoundException: Com.sun.xml.ws.transport.http.servlet.WSServletContextListenerat Org.apache.catalina.loader.WebappClassLoader.loadClass (webappclassloader.java:1645)
Start the Tomcat service, enter HTTP://LOCALHOST:8080/MYWEBSVC/SAYHELLOPORT?WSDL in the browser, and if the display is correct, the service is published successfully.
(iii) WEB service client Development
1. New Java project, File, New, Java project
Enter the project name Usews, finish to finish the new.
2. New Web Service client program, file–> new, other, myeclipse-> Web Services client,
Next go to the next step
WSDL file for Web Service
E:\workspace\myWebSvc\WebRoot\WEB-INF\wsdl\SayHelloService.wsdl
or HTTP://LOCALHOST:8080/MYWEBSVC/SAYHELLOPORT?WSDL.
Next go to the next step,
Finish new.
3. Create a new test class to invoke the Sayhelloservice, File, New, class,
The Finish end class is new.
Modify the class as follows:
Haha, World, O.K.
Using MyEclipse 8.5 to develop JAX-WS-Based Web service instances