In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
Editor to share with you how to build Eclipse WebServices, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Development environment
Sun Java 5 + Eclipse 3.2 + MyEclipse 5.0.0.
Overview
This article introduces the use of MyEclipse Web Service to quickly develop and test a HelloWorld Web Service, including:
1. The basic concept of MyEclipse Web Services is introduced.
two。 Create a MyEclipse Web Services project
3. Create a simple HelloWorld Web Service
4. Deploy Web Service in a Web container, such as Tomcat 5
5. Use Web Services Explorer to test the deployed Web Services
Overview of XFire Java SOAP Framework
MyEclipse Web Services is based on the XFire Java SOAP framework and tools, and XFire is an open source Java SOAP framework. It has a lightweight information processing module that combines with SOAP information through STAX. Provides a simple API that works under Web Services, supporting POJO and schema development. XFire supports Web Services standards,Spring integration, JBI, JAXB, XMLBeans,Java 5 and JAX-WS. And support HTTP, JMS, XMPP, In-memory transport protocols.
one。 Create a Web Service project
A new project type, Web Service project, is introduced in MyEclipse 5.0.This project extends MyEclipse Web Project to support additional Web Service configuration, development and deployment. In this section, you will use Web Services Project wizard to create and configure a new Web Service Projects Web Service Wizard that will do the following:
Create MyEclipse J2EE Web Project
Configure XFire Servlet in the web.xml file in the project
Create a XFire services.xml profile
Add the MyEclipse-XFire class library to the construction path in the project
Add a specified MyEclipse web project builder to the .projects file to deploy the services.xml file to its appropriate location. Such as:
/ WEB-INF/classes/META-INF/xfire/
Run Web Service Project Wizard
The wizard consists of three pages. Page-1 collects Web Project configuration details, Page-2 collects XFire configuration details, and Page-3 configures XFire class libraries in the new build path
1. Execute Web Services Project Wizard.
1)。 Select File > New > Other
2)。 Expand the category of MyEclipse according to the type of J2EE project
3)。 Select Web Services Project and click Next, as shown in the figure
Figure-1: New Project Wizard Launcher
two。 To add Project Name, click Next
Figure-2: Page-2, Collecting web configuration details
3. Add the configuration information of XFire servlet and service.xml files to the Page-2 of the wizard and follow the default values.
Figure-3: XFire servlet and services.xml configuration
Package org.stephencat.ws
Import org.codehaus.xfire.*
Import org.codehaus.xfire.service.*
Import org.codehaus.xfire.service.binding.*
Import org.codehaus.xfire.client.*
Import java.net.*
Public class SampleClient {
/ * *
* @ param args
, /
Public static void main (String [] args) {
Service srvcModel = new
ObjectServiceFactory () create (IHelloWorldService.class)
XFireProxyFactory factory =
New XFireProxyFactory (XFireFactory.newInstance () .getXFire ())
String helloWorldURL =
"http://localhost:8080/HelloWorld/services/HelloWorldService";
Try... {
IHelloWorldService srvc = (IHelloWorldService) factory.create (srvcModel, helloWorldURL)
String result = srvc.example ("hello world")
System.out.print (result)
} catch (MalformedURLException e) {
E.printStackTrace ()
}
}
} this code defines the process of creating a XFire web service proxy that supports the POJO IHelloWorldService interface
Right-click Run As > JavaApplication or Debug As > JavaApplication to run or debug the program
These are all the contents of the article "how Eclipse builds WebServices". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.