This recipe explains how to create a service endpoint interface. A Service Endpoint Interface (SEI) is used in Java for exposing JavaBeans as web services, or more accurately, SEI defines the methods of Java code to be exposed as web services. The interface class must extend the java.rmi.Remote
interface and all methods of the interface must throw java.rmi.RemoteException
.
In our example application, the most appropriate part of the application to expose is the credit card operations module. It already contains all the relevant methods that we want to expose:
Let us first start by checking the new elements in the JDeveloper project as a result of web service creation. We can see a new node where the web service element was created. There is a web service implementation and a web service port type class. We can also inspect the WSDL of the web service by right-clicking on the web service class and selecting Show WSDL for Web Service Annotations in JDeveloper. Another element presents the web content with a web.xml
file, which indicates that we deploy our web service as an application.
If we deploy a web service to the Oracle SOA Suite server and check its WSDL document, we can see the following operations exposed:
AuthoriseCreditCard
Purchase
Refund
OutputTransactions
Void
All of these operations have public access in the JavaBean
definition. All methods marked as private are not exposed as web service operations.
The analogy to the object paradigm exists also in the web service technology. If we want the method in JavaBean
to be exposed, we have to declare it public.
Remember that we have covered the creation of a deployment profile and the deployment of a web service itself in detail in Chapter 8, Exposing Java Code as a SOAP Service in the Publishing a web service recipe.