Creating a service endpoint interface

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.

How to do it…

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:

  1. We right-click on CreditCardGateway.java in JDeveloper.
  2. Select Create Web Service…. The Create Web Service wizard opens at Step 2:
    How to do it…
  3. Select Next, and on the next page, select Add SEI. Then, click on Finish.
    How to do it…
  4. We have now generated a web service ready to be deployed.

How it works…

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.

How it works…

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.

Note

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset