Adding SOAP Services and Web Clients to Productions
About SOAP and Web Services
InterSystems IRIS™ provides support for SOAP 1.1 and 1.2 (Simple Object Access Protocol). This support is easy to use, efficient, and fully compatible with the SOAP specification. This support is built into InterSystems IRIS and is available on every platform supported by InterSystems IRIS. Using InterSystems IRIS SOAP support, you can do the following:
Add a web service to a production to provide a SOAP-enabled front end to the production. Client applications can invoke this production web service by using the SOAP protocol. Such methods can be discovered and invoked by other SOAP-aware applications. InterSystems IRIS runs SOAP methods directly within the database; the execution is highly efficient.
Add a web client to a production. You can use a tool to generate a business operation and the proxy client classes, given the existing WSDL document of the web service you want to use. The InterSystems IRIS web client invokes the external web service via the InterSystems IRIS SOAP outbound adapter and a generated proxy client class.
This chapter discusses the following topics:
InterSystems IRIS Support for Web Services
You can provide a SOAP-enabled front end for your production. To do so, you create an production web service
, which is both a web service and a business service. Internally, your web methods generally receive SOAP request messages, use them to create and send request messages as needed within the production, receive the response messages, and use them to create SOAP response messages.
InterSystems IRIS provides powerful, built-in support for web services. The base production web service class does the following for you:
Validates incoming SOAP messages.
Unpacks SOAP messages, converts data to InterSystems IRIS representation, and invokes the corresponding method, which sends a request message to a destination inside the production.
Receives a response message and then creates and returns a response message (a SOAP message) to the caller.
The SOAP specification does not include session support. However, it is often useful to maintain a session between a web client and the web service that it uses. You can do this with a production web service. If a web service uses sessions, it establishes a session ID and allows repeated calls on the service after one successfully authenticated call from a client.
The production web service class also provides the full functionality of any business service.
To create a production web service, you do not use a production adapter.
InterSystems IRIS Support for Web Clients
At a high level, your InterSystems IRIS web client receives InterSystems IRIS requests, converts them to SOAP requests and sends them to the appropriate web service. Similarly, it receives SOAP responses and converts them into InterSystems IRIS responses.
The InterSystems IRIS web client consists of the following parts, all of which you can generate in Studio by using the SOAP wizard:
A proxy client
class that defines a proxy method
for each method defined by the web service. The purpose of the proxy client is to specify the location of the web service and to contain the proxy methods. Each proxy method uses the same signature used by the corresponding web service method and invokes that method when requested.
A business operation that uses the InterSystems IRIS SOAP outbound adapter to invoke the proxy methods.
Supporting classes as needed to define XML types and production messages.
In order to understand these parts, it is useful to consider how they are generated. First, when you use the SOAP wizard, you provide the URL for the WSDL of the web service of interest. The wizard reads the WSDL and then generates a set of classes.
The generated classes include the proxy client class that defines a proxy method for each method of the web service. Each proxy method sends a SOAP request to the web service and receives the corresponding SOAP response.
As shown in the figure, the generated classes also include classes that define any XML types needed as input or output for the methods.
The Business Operation of an InterSystems IRIS Web Client
The wizard cab also generate a business operation class that invokes the proxy client, as well as classes that define message types as needed. The following figure shows how these classes work:
The classes and methods shown within dashed lines are all generated by the SOAP wizard.
The business operation uses the SOAP outbound adapter, which provides useful runtime settings and the generic method InvokeMethod()
. To invoke a proxy method in the proxy client class, the business operation class calls InvokeMethod()
, passing to it the name of the method to run, as well as any arguments. In turn, InvokeMethod()
calls the method of the proxy client class.