开发者

Using and testing web services in Eclipse

开发者 https://www.devze.com 2022-12-17 07:25 出处:网络
Can you tell th开发者_Go百科e BEST way how to test & use Web Services in Eclipse ? I had little experience with web services, that is, I used an Apache Axis plugin that generated the client stub.

Can you tell th开发者_Go百科e BEST way how to test & use Web Services in Eclipse ?

I had little experience with web services, that is, I used an Apache Axis plugin that generated the client stub.

I do not need to write my own web services right now, only use existing ones. I have Eclipse Java EE, I can download any plugin. What would you suggest?


To test web services, the best tool is IMHO soapUI which is available as an eclipse plugin and is superior by far to any other tool I've used.

To use web services, it's worth noting that Eclipse has now a JAX-WS Tools Project (in the Web Tools Incubator) which is using the Apache CXF implementation (please, let Axis 2 die).

To install this project, point your Eclipse update site manager to The Eclipse Web Tools Platform (WTP) Project update site - http://download.eclipse.org/webtools/updates. When you access the update site, you should see the CXF Web Services (Incubator) feature available in the listing:

Using and testing web services in Eclipse

Once installed and configured (Window > Preferences... > Web Services > CXF 2.x Preferences), you will be able to use the CXF runtime to test web services (and / or to create a CXF Web Services Project, see image below even if this is not your first goal).

Using and testing web services in Eclipse


(source: corneliadavis.com)

You will find some video clips showing you how to create and deploy Bottom-Up and Top-Down Web services using JAX-WS Tools here.


Your Java EE Eclipse already includes WTP (Web Tool Platform), so you shouldn't download another plugin.

All you need now is to follow one of those tutorials


WTP:

The Eclipse Web Tools Platform (WTP) project extends the Eclipse platform with tools for developing Web and Java EE applications

It includes a web services section with 2 components:

  • The JST Web services component contains tools for developing and interacting with Java Web services.
  • The WST Web services component contains tools for Web services development which is not Java specific.


Take a look at Eclipse Swordfish project.

From it's home page:

The goal of the Swordfish project is to provide an extensible SOA framework based on the proven Eclipse Equinox runtime technology. The framework is designed to be complemented by additional open source components such as a service registry, a messaging system, a process engine etc. to form a comprehensive open source SOA runtime environment based on both established and emerging open standards.


Add the WSDL file to the root of an Eclipse project, right-click on it, select "Web Services" and "Generate client", set the cursor to "Assemble" and Eclipse will generate the Java code that will allow you to communicate with the Web Service.


I believe that the easiest way to test web services with Eclipse is the Axis2 plug-in, which is bundled in the Java EE edition. Here is an article about it. It focuses on services and not clients, but it is even easier if you already have a running service and want to create a client.


Axis2 plug-in works fine for creating a testing a web service through a WSDL. I've only tested a simple SOAP web service this way in Eclipse.

What I have not been able to do myself is create another project for example a Dynamic Web App project and create a client WSDL from that web service. I could copy the WSDL into my new project but that would be silly. Realistically we don't copy a WSDL we generate one based on the web service WSDL but through a registered address that points to that web service.

I have read up a little on the CXF option and thought that I had added what I needed to use it. So far I have not seen any of the web service options in Eclipse with the exception of creating and testing a web service in the same project which to me is of little or no use.

0

精彩评论

暂无评论...
验证码 换一张
取 消