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édente | ||
cours:service_oriented_computing_and_web_services:2017-2018:gsoap [2018/04/12 04:45] – [gSOAP] tigli | cours:service_oriented_computing_and_web_services:2017-2018:gsoap [2018/04/12 13:35] (Version actuelle) – [How to publish a WSDL of a web service using gSOAP] tigli | ||
---|---|---|---|
Ligne 2: | Ligne 2: | ||
====== | ====== | ||
- | [[ | + | In this tutorial, we are going to use gSOAP Toolkit. Because gSOAP is working on a lot of OS, I suppose you chose Linux and potential embedded and/or optimized linux like Raspbian on Raspberry Pi. |
+ | |||
+ | |||
+ | ==== gSOAP Toolkit Installation ==== | ||
+ | || | ||
[[https:// | [[https:// | ||
Ligne 8: | Ligne 12: | ||
- | || | + | ||| |
+ | |||
+ | ==== 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 ==== | ||
+ | |||
+ | 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:// | ||
+ | |||
+ | |||
+ | |||
+ | ==== Publish the WSDL of your 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. | ||
+ | |||
+ | On the other hand, as soon as you want to access to specific Operating System and even kernel API, such an approach seems interesting. | ||
+ | |||
+ | 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.1523508326.txt.gz · Dernière modification : 2018/04/12 04:45 de tigli