Page: Using SOAP Services
Page: HTTP Module
Page: Built-in Modules
Page: Getting Binary Data with the SQL Module
Page: Convert Module
Page: Working With the Request
Page: Getting HTTP Query String Parameters
Page: Getting Request Path Parameters
Page: Getting HTTP Headers
Page: Getting the Module Directive
Page: Getting Route Parameters
Using SOAP Services
The Akula Server supports calling WSDL/SOAP-based back end services, conforms to the WS-I Basic Profile Version 1.0 specification, which is a specific subset of functionality of the SOAP protocol.
You can use the HTTP Data Connector Module to make requests and handle results from SOAP-based services in your Akula routes. This section describes how to use that module to make requests to SOAP services. For additional information about the HTTP Module, see HTTP Module.
To connect to a SOAP service:
Define the module configuration file for the HTTP module. This file must include a
<template>tag that defines the request sent to the SOAP service. For example:
Create a route that points to the module configuration file by using the directive of the HTTP module. For example:
Define an endpoint for the client to request. As with standard endpoint definitions, SOAP service endpoints should define a type for each request method that is supported. The following example shows a single endpoint that is triggered on a GET or POST request:
After you deploy the AKZ file that contains these configuration files (named StockQuoteApp, for example), you can access the SOAP service with a request similar to the following:
The following sections describe each of these steps in more detail.
Definining the module configuration file
When defining the module configuration file for an HTTP module that connects to a SOAP service, you define standard top-level tags such as
<content-type> that are expected by the AKHttpModule configuration file. For more information on configuring the akhttp module, see HTTP Module.
<template> tag has special significance when using the akhttp module with a SOAP service because you use it to the define the XML that is passed to the service. It defines the body of the HTTP request that Akula makes to the SOAP service.
In most cases, you should wrap the contents of the <template> tag in a
The exact structure of the
<template> tag is specific to each web service. Typically, you specify at least one namespace. You also define the methods of the service to call with XML child tags, just as you would in any WSDL request. In most cases, you will call a single method per use of the akhttp module. You also pass additional properties or parameters in the
<template> tag, per the SOAP service's definition.
The following examples show example module configuration files that generate requests to SOAP services.
The following example shows a template in the module configuration file for a simple static request. This example does not pass any variable data such as macros in the body.
You can use Akula macros in your
<template> definitions, just as you would in any other portion of the module configuration file. For more information about using Akula macros, see Using Macros.
The following example includes Akula macros that generate dynamic values in the module configuration file:
This example uses macros to define both the base URL of the service, as well as an additional query parameter.
If the body of the request defines the XML required by the SOAP service, then you can simply pass it through by using a macro. This is useful if the module that calls the SOAP service occurs in a route after another module that might have prepared the SOAP request, or if you have some other client-side logic that dynamically generates a SOAP request.
Some SOAP services require additional information to be passed in the HTTP header of the SOAP request.
The following example shows a module configuration file that passes additional information as headers to a SOAP service:
In some cases, the "header data" data must be part of the HTTP request. Check with your SOAP service's documentation to determine if headers are required and how they should be passed.
The following examples shows a template that includes headers that are part of the SOAP request (using the service-specific
<Header> tag). This header data is not included in the HTTP request:
This example also shows that you can use JEXL expressions in your macros. In this case, the expression generates a value for the
Defining the route
To define a route for a module that accesses a SOAP service, use the following syntax in your routeconfig.xml file:
The value of
module_config_file is the location of the module configuration file. The location of this file is relative to the root of the your Akula project. In the following example, the stockquoteGET.xml file is located in the
Defining the endpoints
Endpoint definitions for SOAP requests are the same as HTTP requests. You do not need to define special endpoints to handle requests that connect to SOAP services.