The gSOAP Toolkit Robert van Engelen Kyle Gallivan Florida State University IEEE CCGrid May 22, 2002 1 Overview Web Services gSOAP design and implementation Results Conclusions IEEE CCGrid May 22, 2002 2 Web Services: the Big Picture SOAP DSIG WSDL UDDI SOAP RPC IEEE CCGrid May 22, 2002 3 SOAP Light-weight protocol based on XML as the marshalling format for data in request and response messages Vendor- and platform-neutral Language-neutral Object-model-neutral Transport-neutral XML allows data transformation (XSLT) XML enables long-term data persistence IEEE CCGrid May 22, 2002 4 WSDL IEEE CCGrid May 22, 2002 Web Service registers with UDDI Web Service publishes WSDL Clients can develop proxies from the WSDL for SOAP RPC and messaging 5 gSOAP Open source (C, C++, and Java) >2000 registered users Uses a source-to-source stub and skeleton compiler to automate the integration of SOAP RPC in applications Automates the deployment of (legacy) C/C++ applications as Web Services Automates the development of clients Suitable for high-performance computing IEEE CCGrid May 22, 2002 6 gSOAP Goals Application-centric Minimize application code adaptation Support (de)marshalling of application’s native data structures in SOAP/XML Preserve the logical structure of data Minimize data migration overhead and formatting errors Avoid (hand-written) wrappers Generate fast (de)marshalling routines and streaming XML parsers Efficient run-time remote object allocation IEEE CCGrid May 22, 2002 7 The gSOAP Stub and Skeleton Compiler User application gSOAP-generated Stub/Skeleton and Marshalling Code Runtime Library HTTP/TCP/SOAP and XML API Generates source code stubs and skeletons for SOAP RPC Generates XML (de)marshalling routines for native and userdefined C/C++ data types The gSOAP runtime provides lowlevel HTTP, TCP, SOAP/XML handling and memory management capabilities IEEE CCGrid May 22, 2002 8 Server Development Service Application Specification of Data Types and Remote Procedures in C/C++ Header File gSOAP-generated Skeleton Routines gSOAP Compiler gSOAP-generated Request Dispatcher WSDL IDL IEEE CCGrid May 22, 2002 9 Development Client Specification of Data Types and Remote Procedures in C/C++ Header File Client Application gSOAP gSOAP-generated Stub Routines WSDL IDL IEEE CCGrid May 22, 2002 10 Example Service description (WSDL): Namespace: urn:xmethods-delayed-quotes Method name: getQuote Input parameter: symbol of type xsd:string Output parameter: result of type xsd:float Generated remote procedure declaration for stub generation with gSOAP: ns__getQuote(char *symbol, float &result); Client code: main() { float q; if (soap_call_ns__getQuote(“URL”, “”, “AOL”, q) == 0) cout << “AOL: “ << q << endl; } IEEE CCGrid May 22, 2002 11 Encoding C/C++ Data Types in XML Primitive C/C++ types, enum, struct/class with single inheritance, pointers, arrays, special types (e.g. base64) Not supported: unions, void*, templates, multiple inheritance IEEE CCGrid May 22, 2002 12 Serialization gSOAP generates serialization routines for application types Serialization code traverses object graph at run time to detect coreferenced objects and cycles Serialization code outputs object graph in XML according to SOAP encoding rules IEEE CCGrid May 22, 2002 13 Serialization Example struct BG { int val; struct BG *left; struct BG *right; }; 1 2 3 <BG> <val>1</val> <left> <val>2</val> <right href=“#X”/> </left> <right href=“#X”/> </BG> <id id=“X”> <val>3</val> <right href=“#X”/> </id> IEEE CCGrid May 22, 2002 14 Deserialization gSOAP generates deserialization code, including schema-driven XML pull parser Auto-validating Streaming Fast: match inbound XML elements to “expected” elements in the schema Keep table with “forward” XML refs Back-patching method: resolve forward refs later by copying pointers and/or referenced data IEEE CCGrid May 22, 2002 15 Deserialization Example <BG> <val>1</val> <left> <val>2</val> <right href=“#X”/> </left> <right href=“#X”/> </BG> <id id=“X”> <val>3</val> <right href=“#X”/> </id> 1 2 IEEE CCGrid May 22, 2002 3 16 Results 1. 2. 3. Interoperability testing Legacy code integration Scalability and performance IEEE CCGrid May 22, 2002 17 Interoperability Testing String Integer Float Struct String Array Integer Float Array Array Struct Array Void Base64 Date Hex Decimal Boolean Map Binary Map Array gSOAP PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS SOAP::Lite PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS FAULT Apache 2.2 PASS PASS PASS PASS FAULT PASS FAULT FAULT PASS PASS PASS PASS PASS PASS PASS PASS Apache Axis PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS FAIL FAULT PASS PASS PASS PASS ASP .NET PASS PASS PASS PASS FAIL PASS PASS FAIL PASS PASS PASS FAULT PASS PASS N/A N/A Cape Connect PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS N/A N/A Delphi PASS PASS PASS PASS FAIL PASS PASS FAULT PASS PASS PASS PASS PASS PASS N/A N/A easySOAP++ PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS N/A N/A eSOAP PASS PASS PASS PASS FAIL PASS PASS FAIL PASS PASS PASS PASS PASS PASS N/A N/A Frontier PASS PASS PASS PASS FAULT FAULT FAULT FAULT PASS PASS FAIL FAULT FAULT FAULT N/A N/A GLUE PASS PASS PASS PASS FAIL PASS PASS FAIL PASS PASS PASS N/A N/A MS SOAP 3.0 PASS PASS PASS PASS FAULT PASS FAULT FAULT PASS PASS FAIL PASS PASS PASS N/A N/A nuSOAP PASS PASS PASS PASS FAIL PASS PASS FAIL PASS PASS PASS PASS PASS PASS FAULT FAULT OpenLink Virtuoso PASS PASS PASS PASS FAIL PASS PASS FAIL PASS PASS PASS PASS PASS PASS N/A PEAR SOAP PASS PASS PASS PASS FAIL PASS PASS FAIL PASS PASS FAULT PASS FAIL PASS FAULT FAULT SOAP4R PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS Spheon jSOAP PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS Spray PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS N/A N/A SQLData PASS PASS PASS PASS PASS PASS FAULT FAULT PASS PASS PASS PASS PASS PASS N/A N/A WASP Adv. PASS PASS PASS PASS PASS PASS PASS PASS PASS FAIL N/A PASS PASS PASS PASS PASS PASS PASS N/A N/A White Mesa PASS PASS PASS PASS FAULT PASS FAULT PASS PASS PASS PASS PASS PASS PASS N/A N/A XMLBus PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS PASS N/A N/A 4S4C 2.0 PASS PASS PASS PASS PASS PASS FAULT PASS PASS PASS FAULT FAULT PASS PASS N/A N/A PASS IEEE CCGrid May 22, 2002 WhiteMesa.org “interop lab” Suite of test cases designed for real-time interoperability testing over the Web Apache Axis, .NET, Delphi,… 18 Legacy Code Example: Linear System Solver Application code from Numerical Recipes in C Web Service: IEEE CCGrid May 22, 2002 LU Decomposition Backsubstitution Solve Multi-solve Matrix inversion 19 Linear System Solver Original Numerical Recipes in C routine: ludcmp(double **a, int n, int *indx, double *d) { … sum = a[i][j]; … } Modified routine (array size n stored in class instances): ludcmp(matrix *a, ivector *indx, double *d) { … sum = a[i][j]; … } C++ class declarations for the generation of (de)serializers with gSOAP: class vector { double *__ptr; // pointer to array of double int __size; // run-time array size double& operator[](int i); }; class matrix { vector *__ptr; // pointer to array of vectors int __size; // run-time array size double& operator[](int i); }; IEEE CCGrid May 22, 2002 20 Linear System Solver Remote procedure declaration for stub and skeleton generation with gSOAP: ns__ludcmp ( matrix *a, // input matrix struct ns__ludcmpResponse { matrix *a; // output matrix ivector *i; // output index reordering vector double d; // output parameter for determinant } *result ) Remote procedure SOAP server interface routine called by skeleton: ns__ludcmp(matrix *a, struct ns__ludcmpResponse &result) { result.a = a; // input to output matrix if (ludcmp(result.a, result.i, &result.d) != 0) return SOAP_FAULT; return SOAP_OK; } IEEE CCGrid May 22, 2002 21 Linear System Solver Linear system solver server code (CGI-based): main() { soap_serve(); // process request (skeletons) } Example client code: main() { struct ns__ludcmpResponse result; matrix a; … if (soap_call_ns__ludcmp(“URL”, “”, &a, &result) != 0) soap_print_fault(stderr); … } IEEE CCGrid May 22, 2002 22 Scalability and Performance Scalability and overhead of communication vs. computation LU-based matrix inversion Performance (send 32bit int matrix) Full SOAP XML-encoded matrix SOAP Base64-encoded matrix CGI-based SOAP Web Service Stand-alone SOAP Web Service Java RMI IEEE CCGrid May 22, 2002 23 Matrix Inversion IEEE CCGrid May 22, 2002 Stand-alone linear system solver service (TCP sockets) Full double fp. matrix representation in SOAP XML Total time of client request and server response (10BaseT, Dual PIII 550MHz, Red Hat Linux) 24 CGI-Based Web Service IEEE CCGrid May 22, 2002 Total time of client request and server response (10BaseT, Dual PIII 550MHz, Red Hat Linux) SOAP XML-encoded 32bit int matrix SOAP Base64encoded 32bit int matrix 25 Stand-Alone Service and Java RMI IEEE CCGrid May 22, 2002 Total time of client request and server response (10BaseT, Dual PIII 550MHz, Red Hat Linux) SOAP XML-encoded 32bit int matrix SOAP Base64encoded 32bit int matrix Java RMI (1.2.2) 26 Conclusions Application centric SOAP/XML Web Service interoperable Legacy numerical code integration Scalability and performance Future work: IDL DIME Performance enhancements Peer-to-peer networks IEEE CCGrid May 22, 2002 27