java

Web Service Client

Now lets look at the consumer of the Web Service, on our case the junit testcase WebServiceTest.java

  • We already saw the consumers created dynamically using cxf in the Spring configuration, we are just going to use the injected clients directly in the testcase.

Web Service Implementation

Now that the Web Service interfaces are defined (HelloWorld.java,FileManagement.java), let's look at their implementation details.

Receiving the binary content using DataHandler

The File.java is a simple bean that has 2 properties a string and a DataHandler, the DataHandler is used to receive the file contents sent from the consumer of the web service.

Java Code

Lets walk through the java code now, here we basically define the interfaces for our web services and add the implementation for the same as well

  • The HelloWorld.java interface has a one method that takes in a string parameter. Notice the annotations (@WebService to define a web service and @WebParam to define a parameter)

Simple Web Service using Apache CXF and Spring 2.5.6

Web service allows for inter-operable machine to machine communication. In this article let's learn how to quickly build a simple web service using Apache CXF,Spring 2.5.6 and Maven

Number Service

NumberService.java

  • Most of the configuration is done via annotations itself. The code just does the business logic (i.e to add 2 numbers)
  • Path("/number/") annotation specifies the relative URI path that this class will serve is /number/

A simple REST application using Jersey and Spring 2.5.6

Representational State Transfer (REST) is a simple way to expose and consume resources; predominantly over http. This makes it easy to integrate with consumers of those resources.

Who's online

There are currently 0 users and 1 guest online.

Who's new

  • Saravana Peruma...

Syndicate content