Defining a web service returning a value
This recipe explains how to define a web service with operations that return a value to the client. The methods that are returning values are used in synchronous and asynchronous communication. The best practice when using multiple parameters in web service methods is to define the complex elements and their corresponding complex objects. This also applies to the returning types.
However, we don't always have the ability to define by the best practice. Indeed, when integrating existing applications, we usually bump into legacy methods which we are not able to change.
Getting ready
We will use the book library example that we have used throughout the chapter and enable one of the non-exposed class methods to become a web service operation that returns a value to the client.
How to do it…
The steps involved in defining a web service methods that return values are as follows:
In JDeveloper, open the
BookLibrary.java
interface class. In front of theaddBook...