Presentation is loading. Please wait.

Presentation is loading. Please wait.

INFSO-RI-508833 Enabling Grids for E-sciencE www.eu-egee.org C/C++ source code generation for EMS-WS AuthorAnton Gusev LocationRussia, Protvino, IHEP.

Similar presentations


Presentation on theme: "INFSO-RI-508833 Enabling Grids for E-sciencE www.eu-egee.org C/C++ source code generation for EMS-WS AuthorAnton Gusev LocationRussia, Protvino, IHEP."— Presentation transcript:

1 INFSO-RI-508833 Enabling Grids for E-sciencE www.eu-egee.org C/C++ source code generation for EMS-WS AuthorAnton Gusev LocationRussia, Protvino, IHEP

2 2 Enabling Grids for E-sciencE INFSO-RI-508833 Objectives Web services overview EMS WS architecture SOAP/XML Web services in C/C++ C++ source code building for EMS WS client gSOAP means

3 3 Enabling Grids for E-sciencE INFSO-RI-508833 Web service definition Definition:Definition –A Web service is a software system identified by a URI, whose public interfaces and bindings are defined and described using XML. Its definition can be discovered by other software systems. These systems may then interact with the Web service in a manner prescribed by its definition, using XML based messages conveyed by Internet protocols.

4 4 Enabling Grids for E-sciencE INFSO-RI-508833 WS means What is WS? –Application which allows remote procedure call over LAN/WAN –WS is a messaging program system, messages are XML-based Why WS? –Business  WS-es are public, therefore business-partners may involve/export they business-process  Easy money of WS using and deployment –Using  WS-es are platform independent  Most popular transport protocols support (TCP/IP, HTTP, SMTP,...)  Most popular program language support (Java, Python, C/C++, C#, Perl ant others)  Succession of exist information systems  Simple object access

5 5 Enabling Grids for E-sciencE INFSO-RI-508833 WS stack Application rpcrouter SOAP HTTP TCP/IP Infrastructure (Data link) Application (servlet) Web server SOAP HTTP TCP/IP Infrastructure (Data link) WS stack SOAP  XML envelope HTTP

6 6 Enabling Grids for E-sciencE INFSO-RI-508833 EMS architecture EMS – events producer is any PC Applications –app(1) are any programs which produce log file(s) and some other system valuable information –app(2) are produce system events in EMS event formate (EF) –app(3) are convert log files of app(1) to EF –app(2) and app(3) application provide EMS-events for EMS-WS –EMS-events is XML document, SOAP enveloped. app (2) app (1) app (3) log files producer rpcrouter SOAP XML envelope HTTP network

7 7 Enabling Grids for E-sciencE INFSO-RI-508833 EMS architecture relations between EMS producer and EMS-WS EMS server WEB-server web-service EMS WEB server –includes EMS web service, which holds list of EMS-events in RAM –EMS-ws receives events from producers and sends events to clients by requests app (2) app (1) app (3) log files HTML {SOAP XML[  ]} network producer 1 producer N

8 8 Enabling Grids for E-sciencE INFSO-RI-508833 EMS server WEB-server web-service EMS EMS architecture app (2) app (1) app (3) log files producer 1 app console UI listener 1 listener2 app DB... listener j app GUI Request  (Expat expression)  Response (set of EMS-events, xml-string) producer 2 … producer N

9 9 Enabling Grids for E-sciencE INFSO-RI-508833 C/C++ Web services clients SOAP/XML Web services clients in C/C++ –What You Need  WSDL file Generate by some SOAP tool Obtain from WS-provider  SOAP engine installed Will translate wsdl file to c++ sources Provide SOAP-libraries for c++  C++ compiler installed For build WS-client application WSDL SOAP Engine WSDL  C++ C++ Client stub XML H C++ User code XML H libs User’s project C++  compiler Executable files

10 10 Enabling Grids for E-sciencE INFSO-RI-508833 Source code creation C++ source code building for EMS WS client (1) –EMS-WS WSDL file is available on  http://140.109.98.130/axis/services/urn:EMS?wsdl http://140.109.98.130/axis/services/urn:EMS?wsdl –Assumes  gSOAP use as SOAP engine  Use gcc as c++ compiler  RH-Linux as OS –Command line issue // 1. prepare directory for c++ project  $mkdir csources // 2. download wsdl  $wget http://140.109.98.130/axis/services/urn:EMS?wsdl

11 11 Enabling Grids for E-sciencE INFSO-RI-508833 Source code building C++ source code building for EMS WS client (2) –Command line issue // 3.Generate h-file of WS  $wget 'http://140.109.98.130/axis/services/urn%3AEMS?wsdl‘  //4.Readable name for file  $mvurn\:EMS\?wsdlEMS.wsdl  //5. Obtain a header file from a WSDL document. The gSOAP 'wsdl2h' WSDL parser tool converts the WSDL  $wsdl2h-o ems.hEMS.wsdl //6.The 'soapcpp2' compiler generates the skeleton routines and a WSDL description of the service  $soapcpp2 -I../gsoap-2.7/soapcpp2/ ems.h

12 12 Enabling Grids for E-sciencE INFSO-RI-508833 C++ source code C++ source code building for EMS WS client (3) –Create the main.cpp file, which contents  #include  #include "soapEMSdemoPortSoapBindingProxy.h"  #include "EMSdemoPortSoapBinding.nsmap“  using namespace std;

13 13 Enabling Grids for E-sciencE INFSO-RI-508833 C++ source code C++ source code building for EMS WS client (4) –the main.cpp file content(2) int main(int argc, const char *argv[]) { intgSOAP_result =SOAP_EOM; stringstr_gSOAP_result = ""; ns1__getLatestEventResponse ltstEvRs; EMSdemoPortSoapBinding *EMS;

14 14 Enabling Grids for E-sciencE INFSO-RI-508833 C++ source code C++ source code building for EMS WS client (5) –the main.cpp file content(3) EMS= new EMSdemoPortSoapBinding(); EMS->endpoint= "http://140.109.98.130:80/axis/services/urn:EMS"; EMS->soap->proxy_host= "proxy.ihep.su"; EMS->soap->proxy_port= 3128 gSOAP_result= EMS->ns1__getLatestEvent( ltstEvRs ); str_gSOAP_result= (gSOAP_result == SOAP_OK)? "Yes ":"No";

15 15 Enabling Grids for E-sciencE INFSO-RI-508833 C++ source code C++ source code building for EMS WS client (6) –main.cpp file content(4)  cout<<"\n Use endpoin:\t" endpoint <<"\n Use proxy:\t" soap->proxy_host<< ":" soap->proxy_port ns1__getLatestEvent( ltstEvRs ) responce:\n" <<ltstEvRs.getLatestEventReturn <<"\n SOAP_OK - " <<str_gSOAP_result <<"(" <<gSOAP_result <<")\n";

16 16 Enabling Grids for E-sciencE INFSO-RI-508833 C++ source code C++ source code building for EMS WS client (7) –main.cpp file content(5) if( EMS->soap->error ){ const char **s; if (!*soap_faultcode( EMS->soap )) soap_set_fault(EMS->soap); cerr soap))<< "\n" soap))<< "\n" ; s = soap_faultdetail( EMS->soap ); if (s && *s) cerr << "Detail: "<<(*s)<<"\n"; } return 0; };// end of main function

17 17 Enabling Grids for E-sciencE INFSO-RI-508833 Source code building C++ source code building for EMS WS client (8) –Command line issue // 3.Compile c++ project  $g++ -o emsclient main.cpp soapC.cpp soapClient.cpp -lgsoap //4.try launch executable file emsclient  $./emsclient //5.issue example Use endpoin:http://140.109.98.130:80/axis/services/urn:EMS Use proxy:proxy.ihep.su:3128 EMS->ns1__getLatestEvent( ltstEvRs ) responce: draco.ihep.su/1103785831/0 1103785831 activate ___ 10 10 draco.ihep.su emsclient agusev ___ ___ OO ___ ___ SOAP_OK - Yes (0)


Download ppt "INFSO-RI-508833 Enabling Grids for E-sciencE www.eu-egee.org C/C++ source code generation for EMS-WS AuthorAnton Gusev LocationRussia, Protvino, IHEP."

Similar presentations


Ads by Google