Java Reference
In-Depth Information
1.3 Benefits of Web Services
Web Services provide many benefits:
1.
Platform-independent: Web Services are now available in nearly all platforms:
a) Hardware: mainframe, midrange, personal and mobile devices
b) Operating systems: UNIX, Windows, Mainframe OS, Android, and iPhones
2.
Reuse of existing networking infrastructure: HTTP, SMTP, and JMS protocols
3.
Loose-coupling of software components promotes software reuse
4.
Reduced integration cost and increased integration speed
5.
Open architecture and communication protocols
1.4 Program a HelloWorld Web Service
The concept of a Web Service can be difficult to comprehend without seeing a concrete
example of how a Web Service is created and used. The top-down approach starts with a
WSDL file that describes the services. The top-down approach may increase the level of
interoperability and allow more control of the WS, wehereas the bottom-up approach starts
at the low level of the Java bean or enterprise Java bean (EJB) and is faster and easier.
The following steps can be used to create and test a simple WS application:
1.
Run Eclipse IDE, create a new Java project, and name it 'java-ws'
.
2. Run Server.java as a Java program.
3. Verify the WSDL and the associated schema for the
service endpoint: http://localhost:9999/HelloWorld?wsdl .
4.
Use SOAPUI software to test the HelloWorld Web Service.
5.
Create Java Web Service client code.
1.4.1 Create a Project
In the example above, the bottom-up approach is used. This example requires Java 6 or
later. A Web Service called 'Hello World' is created with the method called 'say, which
requires one String parameter. To create a Java project under Eclipse IDE, perform the
following steps:
Search WWH ::




Custom Search