cours:service_oriented_computing_and_web_services:2017-2018:gsoap
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédenteDernière révisionLes deux révisions suivantes | ||
cours:service_oriented_computing_and_web_services:2017-2018:gsoap [2018/04/12 05:01] – [gSOAP] tigli | cours:service_oriented_computing_and_web_services:2017-2018:gsoap [2018/04/12 13:35] – [How to publish a WSDL of a web service using gSOAP] tigli | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | |||
- | ===== Why use gSOAP ===== | ||
- | |||
- | * Portability: | ||
- | * Stability: the software is mature. Development and testing took place over several years since 2001. The software is used by many industrial projects and products. | ||
- | Broad user base: about one million downloads since 2003, over 6,000 mailing list members, and thousands of license/ | ||
- | * All-in-one package: independence from third-party tools and libraries ensures successful builds and reliable runtime execution. | ||
- | Open source: free open source for non-commercial use (GPL v2). Commercial-use licensing available for purchase. | ||
- | * C and C++ support: supports both pure ANSI C and mixed C/C++ application development. | ||
- | Comprehensive XML data bindings: the gSOAP toolkit implements a pure and native C/C++ data binding to XML using automatic mappings and code generation for user-defined C and C++ data types. The toolkit automatically serializes pointer-based data structures, including cyclic graphs, and supports STL (partly), unions, enums, and class inheritance. Try the online demo (requires URL of WSDL or XSD). | ||
- | * Interoperability and Compliance: the toolkit follows the WS-I Basic Profile 1.0a, 1.1, and 1.2 compliance recommendations. It warns about potential interoperability issues before building a new Web service application, | ||
- | * Industry-standard protocols: SOAP 1.1/1.2 (RPC encoding and document/ | ||
- | Transport: HTTP/S, TCP, UDP (SOAP-over-UDP), | ||
- | * Security: HTTPS and WS-Security: | ||
- | * Speed: the schema-specific compiler-generated code is fast. Benchmarking shows speeds comparable or better than fastest XML parsers (reported by peer-reviewed technical papers). Typical round-trip SOAP service invocation latencies are well below 1ms. | ||
- | Debugging and Testing: in debug mode generates transport and activity logs, also in debug mode the automatic memory management warns about leaks, the tools generate sample XML messages (from WSDL) for on- and off-line testing, automatic generation of echo test server code for client testing. | ||
- | Small footprint: client applications can be under 100K with a total runtime memory footprint of under 150K. Memory management uses garbage collection so (deserialized) data can be cleaned up without a hassle. | ||
- | Numerous examples: the software package includes many code examples, including stand-alone HTTP/1.1 and HTTPS-secure Web Server. | ||
- | * Web server integration: | ||
- | * Active maintenance and development: | ||
- | |||
- | ====== What are the gSOAP tools? ====== | ||
- | Download the latest gSOAP package from the SourceForge gSOAP project site. The gSOAP distribution package includes two compiler tools to develop your applications: | ||
- | The ' | ||
- | The ' | ||
- | The ' | ||
====== | ====== | ||
Ligne 39: | Ligne 13: | ||
||| | ||| | ||
+ | |||
+ | ==== A Quick How-To ==== | ||
+ | ([[http:// | ||
+ | |||
+ | == wsdl2h == | ||
+ | |||
+ | We use the gSOAP ' | ||
+ | |||
+ | To obtain a header file from a WSDL document, run ' | ||
+ | |||
+ | ** wsdl2h -o outfile.h infile.wsdl ** | ||
+ | |||
+ | where infile.wsdl can be a resident WSDL file or a Web location of the WSDL. The outfile.h is the generated output file. | ||
+ | |||
+ | For example: | ||
+ | |||
+ | // wsdl2h -o XMethodsQuery.h http:// | ||
+ | |||
+ | This generates the header file XMethodsQuery.h. The header file defines the service in a more familiar C/C++ header format that you can browse within your IDE. | ||
+ | |||
+ | == soapcpp2 : gSOAP Compiler == | ||
+ | |||
+ | Now, we run the gSOAP compiler ' | ||
+ | |||
+ | {{ : | ||
+ | |||
+ | |||
+ | The gSOAP runtime library provides a transport layer with an HTTP stack on top of TCP/IP as well as secure SSL and DIME/MIME attachment support. | ||
+ | To develop a service application, | ||
+ | |||
+ | |||
+ | {{ : | ||
+ | |||
+ | The ' | ||
+ | |||
==== Tutorial : Getting Start with gSOAP ==== | ==== Tutorial : Getting Start with gSOAP ==== | ||
- | Write your first SOAP and REST Web Services | + | Here you can find a complete step by step tutorial to write yuor first SOAP and REST Web Services, from Hello World to the classical Calc : |
[[https:// | [[https:// | ||
Ligne 48: | Ligne 57: | ||
- | ==== Raspbian | + | ==== How to publish a WSDL of a web service using gSOAP ==== |
+ | || | ||
+ | [[https:// | ||
+ | |||
+ | < | ||
+ | |||
+ | int http_get(struct soap *soap) | ||
+ | { | ||
+ | FILE *fd = NULL; | ||
+ | char *s = strchr(soap-> | ||
+ | if (!s || strcmp(s, "? | ||
+ | return SOAP_GET_METHOD; | ||
+ | fd = fopen(" | ||
+ | if (!fd) | ||
+ | return 404; // return HTTP not found error | ||
+ | | ||
+ | | ||
+ | for (;;) | ||
+ | { | ||
+ | size_t r = fread(soap-> | ||
+ | if (!r) | ||
+ | | ||
+ | if (soap_send_raw(soap, | ||
+ | | ||
+ | } | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | |||
+ | ==== Test the interoperability | ||
+ | |||
+ | After deploying the calc WS-SOAP, test its interoperability with a typical WCF client. | ||
+ | |||
+ | ==== Use gSOAP for monitoring ==== | ||
+ | |||
+ | Of course, this low level programming approach is not very useful to write classical services without any system challenge. | ||
- | Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. An operating system is the set of basic programs | + | On the other hand, as soon as you want to access to specific Operating System |
+ | To illustrate that choose your own prefered POSIX function and test it through a Web Service gSOAP. | ||
+ | If you don't have imagination try // getpid() //. | ||
cours/service_oriented_computing_and_web_services/2017-2018/gsoap.txt · Dernière modification : 2018/04/12 13:35 de tigli