Transcript Web service

Web services in C++
using Globus Toolkit v4
Igor Jeremić <[email protected]>
Faculty of Mathematics - University of Belgrade
http://www.jwork.net/GT4WSC
Content:




Globus toolkit
Web Services
Writing WS in C/C++ using GT4
ndiss Web Service
2
Globus toolkit

The Globus Toolkit is an open source
software toolkit used for building Grid
systems and applications.
3
4
5
Web service


Web service is a system designed
to support interoperable machine-tomachine interaction over a network.
It has an interface that is described
in a machine-processable XML format
6
Writing WS in C/C++ using GT4

Writing WSLD schema
• Defining a WSDL Target Namespace
• Defining Message Types
• Defining Messages & Port Type


Writing service
Writing client
7
http://www.jwork.net/GT4WSC/HelloWorldService/
Writing service


GT4 provide tool for generating web
service skeleton (globus-wsrf-cgen)
for generating additional wsdl
schema we use java program
org.globus.wsrf.tools.wsdl.GenerateBinding
8
http://www.jwork.net/GT4WSC/HelloWorldService/
Writing service

JwHelloPortType_hello_impl function is the place where all
is happening. Unfortunately C++ binding are not supported
http://www.globus.org/toolkit/docs/4.0/common/cwscore/rn01re02.html
[Limitations]
• Only generates bindings from document/literal style
WSDL schemas.
• Only generates ANSI-C bindings. C++ bindings are not
supported.


g++ can not build generated code (using gcc32dbg flavor)
One solution is to use Dynamic libraries
9
http://www.jwork.net/GT4WSC/HelloWorldService/
Writing client


GT4 provide tool for generating client bindings
also that is globus-wsrf-cgen
Client can be written in C or C++, or in any other
supported language ( Java )
10
http://www.jwork.net/GT4WSC/HelloWorldService/
Writing client




#include <JwHelloService_client.h>
New datatypes: (as described in WSDL file)
• helloResponseType (need to be initalized)
• helloType
modules have to be activated, and client have to be
initalized
Service is contacted by JwHelloPortType_hello
function
11
http://www.jwork.net/GT4WSC/HelloWorldService/
Writing client





JwHelloPortType_hello( client_handle,
"http://127.0.0.1:2408/wsrf/services/JwHelloService", &helloS,
&helloR, (JwHelloPortType_hello_fault_t *)&fault_type, &fault);
helloS describe data which needs to be send to service and
HelloR describe data which will be received from service
if parts of HelloResponseType are pointers which point to some
allocated memory you don’t need to free that resource after use
service, GT4 provides mechanism for that
On the end the following functions should be called
JwHelloService_client_destroy();
globus_module_deactivate_all();
12
http://www.jwork.net/GT4WSC/HelloWorldService/
ndiss Web Service
Service provides data manipulation
and program execution with stored
input parameters.
Service skeleton is written in C, and
core of service is written in C++
stored in dynamic library
Client is written in C++
13
http://www.jwork.net/GT4WSC/Ndiss/
ndiss Web Service


Depending of the input parameters,
the client contacts the service once
or twice,
If necessary to upload the model, the
service generates an unique name of
the bc file, returns it to the client
which using GridFTP transfers this
file to the server
14
XML input file example
<?xml version="1.0" encoding="UTF-8"?>
<NDISS>
<Header ProjectName="TEST" Author="Igor Jeremic"
Date="2005-11-11"/>
<Models>
<Model Name="Model01" BoundaryConditionFile="b01.dat"/>
<Model Name="Model02" BoundaryConditionFile="b02.dat"/>
<Model Name="Model03" BoundaryConditionFile="b03.dat"/>
<Model Name="Model04" BoundaryConditionFile="b04.dat"/>
</Models>
</NDISS>
15
http://www.jwork.net/GT4WSC/Ndiss/
Schema
JwNdiss.wsdl
ndissService
Client
nd_MAIN
dataBase
GridFTP
nd_INIT
mySQL
Data base
arguments
option
argLine
exec
tmp
XML
XMLParser
File
System
16
http://www.jwork.net/GT4WSC/Ndiss/
Further work…


Adapt database to the framework
Implement ndiss program as web
service, using MPI-G2
17
Source

Source of this work can be found on
http://www.jwork.net/GT4WSC
Thank you
18