Home | Print | Archive | Blog | Contact
A Newsletter for Unisys EAE and Agile Business Suite Clients | October 2018

Engineering Corner: Calling Web Services Using WebAppSupport

By Howard Bell, Architect – EAE/AB Suite MCP Runtime and Debugger, Unisys

With the new Web Service Wizard in Agile Business Suite (ABSuite®) 6.1, you can easily invoke a Web Service in your ClearPath® MCP application that encapsulates the functionality used by your Reports and Ispecs.

Using the wizard is simple. To create an MCP Web Service, perform the following steps:

  1. Right-click the segment, then select Add>Add New Item.
  2. In the “Add New Item” dialog box, select Web Service>Create. The Web Service Wizard will be displayed.
  3. Enter a name for your Web Service class, then click “Finish.” The example below keeps the default Web Service class name, “WebService1.”

The created class contains the pre-loaded logic and attributes required to exercise the Web Service.

Here’s how it looks when used in conjunction with the Unisys Weather Service. You can invoke the method from an Ispec or Report by setting the WeatherStnCode to any valid ICAO code to test it. For example, choosing “PHNL” will allow you to view the weather in Hawaii.

The added infrastructure to support the Web Service Wizard includes the following classes:

  • Unisys_WebAppSupportLib: An external class configured with all the necessary entry points for the WebAppSupport Service.
  • Unisys_WebAppSupportHelper: A class that simplifies Web Service implementations by consolidating the common processes for establishing and invoking a Web Service.
  • WebAppSupportLibraryBuffers: Contains the specially configured buffers for invoking the WebAppSupport entry points.
  • Unisys_WebAppTypes: All types associated with the WebAppSupport library.

The above wizard not only provides ready-to-run Web Service access from your AB Suite Model,
it also creates all of the necessary infrastructure to support Web Service calls using WebAppSupport.

Using the “WebService1” scenario captured in the image above, you now have a blueprint for
calling other RestFul Web Services.

The Weather Service example above has a fairly simple interface (signature), so LDL+ coding for
access to similar Web Services is a reasonably straightforward task.

For example, calling out to the Weather Service from an AB Suite report simply requires the
following logic:

However, when the interface has many arguments, it does make manually coding the associated AB Suite class attributes a bit more complex. Fortunately, a future AB Suite release will provide enhancements to support the discovery and importing of Web Service class definitions.

In the interim, you can use Business Integrator software as an alternate means of executing this part of the process. All you need to do is create a new Web Service Access Component. And you only need to enter enough information to allow the Web Service “class” to be created.

Here’s how.

Creating a Web Service Access Component

Business Integrator provides a wizard you can use to create a Web Service component specification.

To create the specification, you need to:

  1. Right-click the “Component Specifications” node.
  2. Select New>Web Service Access Component. A wizard will be displayed.
  3. Complete the necessary information and proceed through each page of the wizard.
  4. Follow the above steps to create a .Model file, using Action>Extract. Next, in “Save as Type,” select the .Model type for AB Suite.

Once you complete these steps, move over to AB Suite, import the model, and give it the Segment name “NEW OWNER.”

As shown above, this will result in an Ispec with the structure, layout, and format of the required Web Service. But since only the Ispec’s class will be used for the Web Service call attribute definitions, the stereotype can be removed. This new “Web Service” class can now be modified to include an INVOKE method, which calls the various WebHelper methods – using the same approach and order as the “WebService1” scenario above – and returns the results of the call into its local attributes. Note that the “INVOKE method” name was chosen to maintain consistency with the wizard’s provided structure.

Strictly speaking, WebAppSupport supports RESTful Web Services. However, this doesn’t preclude you from using it to call SOAP Web Services. To do that, you’ll just need to provide some additional LDL+ Logic for crafting the XML request as a SOAP request, and then parsing the XML SOAP response.

Subscribe | Unisys.com | Comment | Newsletter Archive