180 likes | 359 Views
Web services in C++ using Globus Toolkit v4. Igor Jeremi ć < igor@jwork.net > 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. Globus toolkit.
E N D
Web services in C++ using Globus Toolkit v4 Igor Jeremić <igor@jwork.net> 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
Globus toolkit • The Globus Toolkit is an open source software toolkit used for building Grid systems and applications.
Web service • Web service is a system designed to support interoperable machine-to-machine interaction over a network. • It has an interface that is described in a machine-processable XML format
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 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 http://www.jwork.net/GT4WSC/HelloWorldService/
Writing service 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 http://www.jwork.net/GT4WSC/HelloWorldService/
Writing client • GT4 provide tool for generating client bindingsalso that is globus-wsrf-cgen • Client can be written in C or C++, or in any other supported language ( Java ) 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 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 calledJwHelloService_client_destroy(); globus_module_deactivate_all(); 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++ 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
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> http://www.jwork.net/GT4WSC/Ndiss/
Schema JwNdiss.wsdl ndissService Client nd_MAIN dataBase GridFTP nd_INIT mySQL Data base arguments argLine exec XML File System option tmp XMLParser http://www.jwork.net/GT4WSC/Ndiss/
Further work… • Adapt database to the framework • Implement ndiss program as web service, using MPI-G2
Source • Source of this work can be found on http://www.jwork.net/GT4WSC Thank you