This chapter contains the following recipes:
@WebService
@SOAPBinding
Real production environments still operate on many legacy applications that are written in a variety of programming languages. As the adaptation of the applications for integration presents a big work effort and costs a lot of money, a better approach is to expose the application functionality through API and web services. Other mechanisms for integration are also mentioned in this book, such as REST, JMS, EJB, and so on. This way, however, it is easier to integrate other applications with legacy application, as we can integrate different applications in a technology-neutral manner. Also, we can take advantage of other web service features such as interoperability and reusability.
As this book addresses Java and BPEL, we cover the aspects of how to expose the already existing Java code as a web service. To some extent, we already covered this in Chapter 8, Exposing Java Code as a SOAP Service. We start by defining the service interface which presents the entry point for other applications to integrate. The rest of the recipes cover usage of annotations for web service decoration. The last recipe shows you how to publish a web service without using an application server. In the early stages, such publishing might present a much better alternative as opposed to using an application server.
Throughout this chapter, we will work on the sample application we have prepared. The sample presents a simplified version of a credit card gateway for processing purchases, refunding, and voiding operations. The application consists of the following two components:
CreditCardGateway.java
): Operators are able to perform various operations. We omit the user interface design for simplicity.BackEndSystem.java
): Presents the core of the credit card operations.Throughout the recipes, we will explore the ways in which to expose functionality of the sample application as a web service in order to enable credit card operations by other parties automatically without human intervention.