Generate the server-side code

Next the WSDL is put through the Axis2 tool to generate the server code. This server code contains logic to receive XML from the HTTP server using SOAP (which contains the input data), parse it, and create the types to pass to the main application. It also contains code to turn these types back to XML and return to the Web server, which will return a SOAP response.

  1. Right-click BookLegacy.wsdl in COBOL Explorer and select New > Other.
  2. Select Web Service under Web Services and click Next.
  3. If the first time configuration for Axis2 has been done, then Web service runtime will show Apache Axis2. If it instead shows Apache Axis, then click on it to change. This will open the Service Deployment Configuration dialog box. Select Apache Axis2 and click OK.
  4. Click Finish. A progress bar might appear while it generates the code.
  5. Once the code is generated the file BookLegacySkeleton.java should appear in an editor pane.
  6. It is a good idea to reformat the source code at this point. Right-click in the editor pane, select Source > Format.

Comments

The classes BookDetail, BookReturn, BookReturnE, NewBook, and StockNo hold instances of the types represented in the WSDL.

In the outline view for BookLegacySkeleton.java are four methods, nextBook(), readBook(), deleteBook(), and addBook(). These are the methods that are called by the web service for the operations that were defined and are where user code goes.

Because you might want to regenerate this code, it is a good idea to keep the user code in this file to a minimum and have all the logic in a separate class. Each of these methods will contain one line to invoke an appropriate method in a new class called BookOperation. Therefore the next step is to create this class which interfaces between the Web service and the COBOL application.