Outils pour utilisateurs

Outils du site


cours:service_oriented_computing_and_web_services:2017-2018:gsoap

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
cours:service_oriented_computing_and_web_services:2017-2018:gsoap [2018/04/12 07:01]
tigli [gSOAP]
cours:service_oriented_computing_and_web_services:2017-2018:gsoap [2018/04/12 15:35]
tigli [How to publish a WSDL of a web service using gSOAP]
Ligne 1: Ligne 1:
- 
-===== Why use gSOAP ===== 
- 
-  * Portability:​ gSOAP supports most platforms, including embedded systems and small OS (for example WinCE, Symbian, and PalmOS). Portability is tested for Windows (98, XP, Vista), Linux, Unix, Mac OS X, Solaris, HP-UX, AIX, FreeBSD, TRU64, Irix, QNX, and VxWorks. 
-  * 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/​support agreements with companies. Here is a brief selection of the success stories and a summary of user testimonials. 
-  * 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,​ so you don't have to go through another development cycle to make your services compliant. In addition, a report is available to check compliance. In addition, the W3C Databinding Interoperability Results for gSOAP show exceptionally good XML-to-type mappings (true XML-to-type mappings, not XML to DOM-like structures). 
-  * Industry-standard protocols: SOAP 1.1/1.2 (RPC encoding and document/​literal styles), WSDL 1.1/2.0, and UDDI v2. WS-Policy 1.2/1.5, WS-SecurityPolicy 1.2, WS-ReliableMessaging,​ WS-Addressing. Supports XML schema primitive XSD types, simpleTypes,​ complexTypes,​ extension, restriction,​ elements, attributes, element/​attribute references, sequence/​all/​choice,​ groups, attributeGroups,​ substitutions,​ any/​anyAttribute,​ schema import/​include/​redefine,​ and SOAP arrays (including polymorphic and multi-dimensional sparse arrays). 
-Transport: HTTP/S, TCP, UDP (SOAP-over-UDP),​ MIME (SwA), DIME (streaming),​ MTOM (streaming),​ HTTP1.0/​1.1,​ IPv4, IPv6, RSS, XML-RPC, WS-Addressing. HTTP stack supports HTTP/1.1 POST/GET SOAP/XML messaging with compression,​ chunking, keep-alive, logging, and SSL encryption. 
-  * Security: HTTPS and WS-Security:​ authentication,​ tokens, digital signatures. 
-  * 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:​ includes Apache_mod, IIS, WinInet, CGI, and FastCGI interfaces to integrate your services. 
-  * Active maintenance and development:​ the software is feature rich, but there are always new features to be desired. See the latest news on current developments and future plans. 
- 
-====== 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 '​wsdl2h'​ WSDL parser. This tool converts WSDLs and XSD files into annotated C/C++ definitions. 
-The '​soapcpp2'​ stub and skeleton compiler. This tool generates RPC code and XML serializers from the annotated C/C++ definitions. 
-The '​wsdl2h'​ parser converts WSDL into gSOAP header file specifications of Web services. This specification gives a C/C++ transparent view of the server'​s functionality. The header file is processed by '​soapcpp2'​ to generate the source code stubs and skeletons to invoke the service or build a new service based on the WSDL. 
  
 ====== ​ gSOAP ====== ====== ​ gSOAP ======
Ligne 39: Ligne 13:
  
 ||| |||
 +
 +==== A Quick How-To ====
 +([[http://​www.cs.fsu.edu/​~engelen/​soap.html|Original Reference]])
 +
 +== wsdl2h == 
 +
 +We use the gSOAP '​wsdl2h'​ WSDL parser to obtain the gSOAP header file specification of a Web service from a WSDL document.
 +
 +To obtain a header file from a WSDL document, run '​wsdl2h'​ on a WSDL: 
 + 
 +** 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://​www.xmethods.net/​wsdl/​query.wsdl //
 +
 +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 '​soapcpp2'​ on the gSOAP header file to produce the source code to implement the client application. The '​soapcpp2'​ stub and skeleton compiler generates proxies (and RPC stubs) for your client application as follow :
 +
 +{{ :​cours:​service_oriented_computing_and_web_services:​2017-2018:​client.gif?​700 |}}
 +
 +
 +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,​ run the gSOAP '​wsdl2h'​ parser on a WSDL to create a gSOAP header file. The header file is compiled with the '​soapcpp2'​ compiler as follow: ​
 +
 +
 +{{ :​cours:​service_oriented_computing_and_web_services:​2017-2018:​server.gif?​700 |}}
 +
 +The '​soapcpp2'​ compiler generates the C/C++ Web service skeletons. You can also take a legacy C/C++ application and develop a service simply by entering the C/C++ Web service method operations and data types into a header file. The '​soapcpp2'​ compiler generates the source code for your project and produces a WSDL to advertize your Web service .
 +
  
 ==== Tutorial : Getting Start with gSOAP ==== ==== Tutorial : Getting Start with gSOAP ====
  
-Write your first SOAP and REST Web Services ​following these instructions ​+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://​www.genivia.com/​dev.html|Getting Start with gSOAP]] [[https://​www.genivia.com/​dev.html|Getting Start with gSOAP]]
Ligne 48: Ligne 57:
  
  
-==== Raspbian ​====+==== Publish the WSDL of your web service using gSOAP ==== 
 +|| 
 +[[https://​www.cs.fsu.edu/​~engelen/​soapdoc2.html#​tth_sEc19.10| In HTTP GET Support ...]] find an example that  produces a WSDL file upon a HTTP GET with path ** ?wsdl ** 
 + 
 +<​code>​ 
 + 
 +int http_get(struct soap *soap) 
 +
 +   FILE *fd = NULL; 
 +   char *s = strchr(soap->​path,​ '?'​);​ 
 +   if (!s || strcmp(s, "?​wsdl"​)) 
 +      return SOAP_GET_METHOD;​ 
 +   fd = fopen("​myservice.wsdl",​ "​rb"​);​ // open WSDL file to copy 
 +   if (!fd) 
 +      return 404; // return HTTP not found error 
 +   ​soap->​http_content = "​text/​xml";​ // HTTP header with text/xml content 
 +   ​soap_response(soap,​ SOAP_FILE);​ 
 +   for (;;) 
 +   { 
 +      size_t r = fread(soap->​tmpbuf,​ 1, sizeof(soap->​tmpbuf),​ fd); 
 +      if (!r) 
 +         ​break;​ 
 +      if (soap_send_raw(soap,​ soap->​tmpbuf,​ r)) 
 +         ​break;​ // can't send, but little we can do about that 
 +   } 
 +   ​fclose(fd);​ 
 +   ​soap_end_send(soap);​ 
 +   ​return SOAP_OK; 
 +}  
 + 
 +</​code>​ 
 + 
 +==== 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 ​and utilities that make your Raspberry Pi run. However, Raspbian provides more than a pure OS: it comes with over 35,000 packagespre-compiled software bundled in a nice format for easy installation on your Raspberry Pi.+On the other hand, as soon as you want to access to specific Operating System ​and even kernel APIsuch 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.txt · Dernière modification: 2018/04/12 15:35 par tigli