SOA Gateway Version 2010-05-31
 —  Administration  —

Using the SOA Gateway to access Shared Libraries or DLLs

Using the SOA Gateway to access Shared Libraries or DLLs


Introduction

You can also use the SOA Gateway to access existing shared libraries or DLLs without any rebuilding or reverse-engineering.

You just need to Know the name of the function you wish to call, and what the input and output parmeters look like.

In this HOWTO, we'll build a piece of code into a DLL, and show you how to use the SOA Gateway to expose a function within this as a Web Service.

Top of page

Building the DLL

Consider this simple piece of C++ code.

#include <string.h>

#ifdef WIN32
 #define PLATFORM_EXPORT __declspec( dllexport )
#else
 #define PLATFORM_EXPORT
#endif

extern "C" PLATFORM_EXPORT int calc( char operation[20], int *operand1, int *operand2, int *result );

extern "C" int calc( char operation[20], int *operand1, int *operand2, int *result ){

	if( !strcmp( operation, "add" )){
		*result = (*operand1) + (*operand2) ;
	}
	else if( !strcmp( operation, "sub" )){
		*result = (*operand1) - (*operand2) ;
	}
	else if( !strcmp( operation, "mul" )){
		*result = (*operand1) * (*operand2) ;
	}
	else if( !strcmp( operation, "div" )){
		*result = (*operand1) / (*operand2) ;
	}
	else{
		*result = 0;
		return -1;
	}

	return 0;
}

This is simple calc method which will take a string, two integers, and return a integer based on the value of string.

For the purposes of this HOWTO, we are running the SOA Gateway on Windows, and will build the above code into a Windows DLL using MS VC++.

If the SOA Gateway is running on Linux, the DLL should be built there, and so on, depending on the platform.

A pre-built Windows (x86) DLL is available here

Top of page

SOA Gateway Configuration

The SOA Gateway must now be configured to load and run this DLL.

Ideally, our new DLL will be available in the system PATH. On Unix-based systems, you should change to the directory where the DLL is located, and run the command export PATH=$PATH:$PWD. Now restart the SOA Gateway in this shell.

On z/OS, ensure the load library containing the DLL is in your STEPLIB concatenation.

As Windows requires a restart before picking up a new system PATH, the simplest thing to do is copy the built DLL into the bin directory of your SOA Gateway installation. Assuming the default installation was used, this will be C:\Program Files\Risaris Limited\SOA Gateway {v.r.m}\Apache\bin\ where {v.r.m} denotes the actual SOA Gateway server version in use.

Now start your SOA Gateway Control Center and choose one of the following methods of creating a WebService based on the "calc" example

Create ("Discover") the WebService automatically

Define the WebService manually

Top of page

Accessing DLL using the SOA Gateway

This section will show you how to access our new DLL Web service.

Top of page