EGL では、以下に示すインターフェース・パーツを使用してサード・パーティー REST サービスにアクセスできます。
interface IRest
function invokeGet(reqURL string in) returns(string)
{@getRest {uriTemplate="{reqURL}"}};
function invokePost(reqURL string in, representation string in) returns(string)
{@postRest {uriTemplate="{reqURL}"}};
function invokePut(reqURL string in, representation string in) returns(string)
{@putRest {uriTemplate="{reqURL}"}};
function invokeDelete(reqURL string in, representation string in) returns(string)
{@deleteRest {uriTemplate="{reqURL}"}};
end
このインターフェース・パーツをそのままの状態で使用すると、インターフェース・パーツを作成する必要がなくなります。しかし、サービス呼び出し文のコーディングに必要な作業は異なります。
myVar IRest;
myResource String = ServiceLib.convertToJson(myRec);
call myVar.invokePost("http://www.example.com", myResource)
returning to myCallbackfunction;
myString STRING:
myVar IRest;
myResource String = ServiceLib.convertToJson(myRec);
myString = myVar.invokePost("http://www.example.com", myResource);
myVar IRest {@RESTService {baseURI="http://www.example.com"};
myResource String = ServiceLib.convertToJSON(myRec);
call myVar.invokePost("", myResource)
returning to myCallbackfunction;
function invokeDelete(reqURL string in) returns(string)
{@deleteRest {uriTemplate="{reqURL}"}};