• 大小: 0.98M
    文件类型: .pdf
    金币: 1
    下载: 0 次
    发布日期: 2021-03-26
  • 语言: 其他
  • 标签: 其他  

资源简介


官方提供的 gSOAP 2.8.66 用户指南,高清带书签,共298页
9 Using the soapcpp2 Compiler and Code generator 92 9.1 soapcpp2 Options 93 9.2 SOAP 1.1 VersuS SOAP 1.2 and Dynamic Switching 9.3 The soapdefs h Header File 9.4 How to Build Modules and Libraries with the #module Directive 9.5 How to use the import D 98 9.6 ow to Use +Include an d #define Directives 9.7 Coinlpiling a SOAP/XML Client ApplicatiOn with soapcpp2 9.8 Compiling a SOAP/ XML Web Service with soapcpp2 9.9 Compiling Web Services and Clients in ANSI C 100 9.10 Limitations of gSOAF 9.11 Library build Flags 9.12 Run Timc Flags 104 9.13 Memory Management 107 垂 9.13.1 Memory Allocation and management policies 9. 13.2 Intra-Class Memory management 110 9. 14 Debugging 112 9. 15 Generating an Auto Test Server for Client Testing 113 9.16 Generating Deep Copy and Deletion Code ..113 9.17 Required libraries 114 10 The gSOAP Scrvicc Opcration Spccification Format 114 10.1 Service Operation Parameter Passing 116 10.2 Error Codes ..117 10.3 C/C++ Identifier Naine to XML Tag Nale Mapping 120 10.4 Namespace Mapping Table 11 gSoAP Serialization and Deserialization Rules 126 11.1 SOAP RPC Encoding Versus Document/Literal and xsi: type Info 126 11.2 Primitive Type Encoding 127 11.3 How to Represent Primitive C/C++ Types as XSD Types 128 11.3.1 How to Usc Multiplc C/C++ Typcs for a Singlc Primitivc XSD Typc . 134 11.3.2 Ilow to use C++ Wrapper Classes to Specify Polymorphic Primitive Types 134 11.3.3 XSD Scheina Type Decoding Rules 136 11.3.4 Multi-Reference Strings 139 1.3.5". String'Mixed-Content Decoding 139 11.3.6 C++ Strings 11.3.7 Changing the Encoding Precision of Hoat and double Types.......140 11.3.8 INF, - INF, and nan Values of float and double Types 11.4 Enumeration serialization 142 11.4.1 Serialization of Symbolic Enumeration Constants 142 11.4.2 Encoding of Enumeration Constants 14 11.4.3 Initialized Enumeration Constants .143 11.4.4 How to"Rcusc"Symbolic Enumeration Constants 143 11.4.5 Boolean Enumeration Serialization for C 144 11.4. 6 Bitmask Enumeration Serialization 11.5 Struct serialization 145 1. 6 Class Instance Serialization 146 11.6.1 Example 11.6.2 Initialized static const Fields 148 11.6.3 Class method 149 11.6. 4 Getter and setter Methods 149 11.6.5 Streaming XMl with getter and setter methods 11.6.6 Polymorphism, Derived Classes, and Dynamic Binding 151 11.6. 7 XML Attributes 154 11.6.8 QName Attributes and Elements .155 11.7 Union Serialization 156 11.8 Serializing Pointer Types 1.8.1 Multi-Referenced Data 11.8.2 NULL Pointers and Nil elements ..159 11. 9 Void pointers 160 11.10Fixed-Size arrays 11. 1l Dynamic Arrays ..162 11.11. 1 SOAP Array Bounds limits 162 11. 11.2 One-Dimensional Dynamic SOAP Arrays 11.11.3 Example 163 11.11. 4 One-Dimensional Dynamic SOAP Arrays With Non-Zero Offset 165 1. 11.5 Nested One-Dimensiona.I Dynamic SOAP Arrays 166 1. 11.6 Multi-Dimensional Dynamic SOAP Arrays 167 11. 11.7 Encoding XML Generics Containing Dynamic Arrays 168 11.11. 8 STL Containers 170 11. 11.9 Polymorphic Dynamic Arrays and Lists 11.11. 1dHow to Change the Tag Naines of the Elements of a SoaP Array or List 174 11.12 Base64Binary XML Schema Type Encoding 175 11.13hex Binary XML Schema Type Encoding l77 11.14Literal XML Encoding Style 178 11. 14. 1 Serializing and Deserializing Mixed Content XML With Strings 180 12 SOAP Fault Processing 181 13 SOAP Header Processing 184 14 MIME Attachments 186 14.1 Sending a Collection of MIME Attachments(SwA 14.2 Retrieving a Collection of MIME Attachments(SwA 189 15 DIME Attachments 189 15. 1 Sending a Collection of DIME Attachments 190 15.2 Retrieving a Collection of DIME Attachments .190 15.3 Serializing Binary Data in DIME 15.4 Streaming DIME 194 15.5 Streaming Chunked DIME 15.6 WSDL Bindings for dIme attachments 198 16 MTOM Attachments 198 16. 1 Generating Multipart Related MIME Attachment Bindings in WSDL 200 16.2 Sending and Receiving MTOM Attachments 200 16.3 Streaming MTOM/MIME 16.4 Redirecting Inbound MTOM/ MIME Streams Based on SOAP Body Content 16.5 Streaming Chunked MTOM/MIME 17 XML Validation 209 17.1 Occurrence Constraints 209 17.1.1 Default valucs 209 17.1.2 Elements with min Occurs and maxOccurs Restrictions 210 17.1.3 Rcquircd and Prohibited Attributes 210 17.2 Valuc Constraints 211 17.2.1 Data Length Restrictions 211 17.2.2 Valuc Rangc restrictions 21 17.2.3 Pattern Restrictions 213 17.3 Elcmcnt and Attribute Qualificd /Unqualified Forms 213 18 SOAP/XML Over UDP 216 18.1 Using ws-Addrcssing with SOAP-ovcr- UDP .217 18.2 Client-side One-way Unicast 18.3 Clicnt-sidc Onc-way Multicast ..218 18.4 Client-side request-Response Unicast 219 18.5 Clicnt-sidc Rcqucst-Rcsponsc Multicast 219 18.6 SOAP-over-UDP Server 221 18.7 SOAP-over-UDP Multicast Receiving server 222 1 9 Advanced features 223 19.1 Internationalization 223 19.2 Customizing the WSDL and Namespace Mapping Table File Contents With SOAP Dircctivcs 223 19.2.1 Example 231 19.3 Transient Data Types 232 19.4 Serialization as is"with Volatile Data Types 234 19.5 How to Declare User-Defined Serializers and deserializers 23 19.6 How to Serialize Data Without Generating XSD Type attributes 236 19.7 Function Callbacks for Customized 1/o and Http Handling 237 19. 8 Http 1.0 and 1.1 245 19.9 Http 307 Temporary Redirect Support 245 19.10httpGetSupport 246 19.11tcpandhttpKeep-alive 247 19.12httpChunkedTransferEncoding 249 19.13httpBufferedSends 19.14httpAuthentication 19.15IITTP NTLM Authentication 251 19.16httpProxyNtlmAuthentication 252 19.17httpProxybasicauthentication .253 19.18Messaging Speed and Performance Improvement Tips 253 19.19XML Parsing Options to set Safety Guards 254 19.20Timcout Managcmcnt for Non-Blocking Opcrations 19.21 Closing Connections by Force 2 19.22 Socket Options and Flags 256 19.23Overriding the host and port to connect 257 19.24secure Web Services with Https/Ssl 257 19. 25secure Clients with Https/ssl 262 19.26SSL Authentication Callbacks ..264 19.27SSL Certificates and Key files 19.28SSL Ilardware Acceleration 267 19.29SSL on Windows 19.30Zlib Compression 267 19.31Client-Side Cookie Support 269 19.32Server-Side Cookie Support 270 19.33 Connecting Clients Through Proxy Scrvcrs 19.34 Bind Before Connect and Setting the Client Interface Address 19.35FastCGI Support 274 19.36 How to Create gSOAP Applications With a Small Memory Footprint 274 19.37How to Eliminate BSD Socket Library linkage 275 19.38How to Combine Multiple Client and Server Implementations into one Executable 276 19.39 How to Build a Client or Server in a C++ Code Namespace ...,..276 19.40 How to Create Client/ Server Libraries 277 19.40. 1 C++ Clients Example 278 19.40. C Clients Example .281 19.40.3C Services Chaining Example 283 19. How to Create dlls 284 19 41.1 Create the Base stdsoap2 dll 284 19.41.2 Crcating Client and Scrvcr DlLs .285 19.42g SOAP Plug-ins 285 19.42. 1 The Message Logging and statistics Plug-in 19, 42.2 RESTful Client -Side API 289 19.42.3rfstfullServer-sideApi:Thehttpgftplug-in 289 19.42.4 RestfuL Server-side Apl: The Http Post Plug-in 19.42.5 The Http Md5 Checksum Plug-in 292 19.42.6ThehttpDigestAuthenticationPlug-in 19.42. 7 The ws-addressing Plug-in 295 19.42. 8 The ws-ReliableMessaging Plug-in .295 19.42. 9 The WS-Security Plug-in 296 19.42.I0NS-Discovery 296 Copyright(C)2000-2018 Robert A. van Engelen, Genivia Inc, All Rights Reserved 1 Introduction The g soap tools provide an automated SoAP and XMl data binding for C and Ctt bascd on compiler technologies. The tools simplify the development of SOAP/XMI Web services and XML application in C and C++ using autocode generation and advanced mapping methods. Most toolkits for Web services adopt a WSDL/SOAP-centric view and offer APIs that require the use of class libraries for XML-specific data strucLures. This forces a user lo adapt the application logic to these libraries because users have to write code to populate XML and extract data from XML using a vendor-specific API. This often leads to fragile solutions with little or no assurances for data consistency, type safety, and XML validation. By contrast, gSoap provides a type-safe and transparent solution through the use of compiler technology that hides irrelevant WSDL-, SOAP- REST-, and XML-specilic protocol details Iron the user, while automalically ensuring XML validi checking, memory management, and type-safe serialization. The gSoaP tools automatically map native and user-defined C and C++ data types to semantically equivalent Xml data types and vice-versa. As a result. full SOAP/REST XML interoperability is achieved with a simple API relieving the user from the burden of WSDL/SOAP/XML details, thus enabling him or her to concentrate on the application-essential logic The gSOaP tools support the integration of (legacy)C/C++ codes(and other programming lan- guages when a C interface is available), embedded systems, and real-time software in SOAP/XML applications that share computational resources and information with other SoaP applications possibly across different platforms, language environments, and disparate organizations located behind firewalls The gsoap tools are also popular to implement XMl data binding in C and C++. This means Chat applicatiol-nalive dala strucLures can be encoded in XML automatically, without the need to write convcrsion codc. The tools also producc XML schemas for thc XML data binding, so cxtcrnal applications can consume the XML data based on the schemas 1.1 Getting Started To start building Web services applications or automate XML data bindings with gSoAP, you nee .ThegsoaPpackagefromhttps://www.genivia.com/products/Downloads.htmlandse- lect the gSoaP toolkit cOmmercial edition, or download the GPL open source version [rom Sourceforgehttps://sourceforge.net/projects/gsoap2 a C or C++ compiler . You may want to install Openssl and the Zlib libraries to enable Ssl(httPs) and com- pression. These libraries are available for most platforms and are often already installed The gSOAP software is self-contained, so there is no need to download any third-party software cxccpt whcn you want to usc Opcnssl for Https andor Zlib comprcssion The gsoap distribution package includes The wsd12h WSDL/schema converter and dala binding loc The soapcpp2 stub/skeleton compiler and code generator Binaries of these two tools are included in the gSoaP package in gsoap/bin for Windows and Mac OS plarforms, see also the reaDME files in the package for more details Although gsoap tools arc availablc in binary format for scvcral platforms. the code gencratcd by these tools are all equivalent. This means that the generated source codes can be transferred to other platforms and locally compiled If you dont have the binaries or if you want to rebuild them, you need Bison (or Yacc) to build soapcpp Flex(or Lex) to build soapcpp2 e A C++ compiler to build wsdl2h Bison and Flex are preferred. Both are released under open source licenses that are compatible with gSOAP's licenses .Bisonisavailablefromhttp://www.gnu.org/software/bison Flexisavailablefromhttp://flex.sourceforge.net You can also build soapcpp2 without Bison and Flex installed, see installation instructions on the SOAP web site The gSoap engine is built as a library libgsoap a and libgsoap++ a with separate versions of these two libgsoapssL a and libgsoapssl++ a that support ssl. See the rEadme.txt instructions on how to build these libraries with the platform-independent gsoap package's autoconf and automake Alternatively, you can compile and link the engine's source code stdsoap2 c(or stdsoap2 cpp for C++ directly with your code The gSoap packages contain numerous examples in the samples directory. Run make to build the example applications. The examples are also meant to demonstrate different features of gSOAP.A streaming Mtom attachment server and client application demonstrate efficient file exchanges in samples/mtom-stream. An SSL-secure Web server application demonstrates the generation of dynamic content for Web browsing and Web services functionality at the same time, see samples/webservice And much more 1.2 Quick Start: Developing a Web Service Client Application The gSOaP tools minimize application adaptation efforts for building Web services by using a XML data binding for C and c+t implemented by advanced XML schema analyzers and source- to-source code generation tools. The gSoaP wsdl2h tool imports one or more WSDls and XML schemas and generales a gSOAP header file with familiar C/C++ syntax lo deline the Web service operations and the C/C++ data types. The gSOAP soapcpp2 compiler then takes this header file and generates XML serializers for the dala ly pes(soap. h and soapC cpp), the client-side stubs (soap Client. cpp), and scrvcr-sidc skclctons(soap Server. cpp The gSOAP soapcpp2 compiler can also generate WSDL definitions for implementing a service from scratch, i.e. without defining a WSDL first. This " closes the loop in that it enables Web services development from WSDL or directly from a set op C/c++ operations in a header file without the need for users to analyze Web service details You only need to follow a few steps to execute the tools from the command line or Makefile(see also MsvC++ project examples in he samples directory with tool integration in the MSvC++ IDE). For cxamplc, to gcncratc codc for thc calculator Web service, we run the wsdI2h tool from the command line on the URL of the WSDL and use option -o to specify the output file >wsdi2h-ocaic.hhttp://www.genivia.com/calc.wsdl This generates the calc h service definition header file with service operation definitions and types for the operation's data. This header file is then to be processed with soapcpp2 to generate the stub and or skeleton code and XML serialization routines. The calc. h file includes all documentation soyoucanuseDoxygen(http://www.doxygen.org)toautomaticallygeneratethedocumentation pages for your development The wsdl2h-generated service definitions header file also contains information on the use of the service, such as WS-Policy assertions when applicable In this example we are developing a C++ API for the calculator service. By default, gSOAP assumes you will use C++ with STL. To build without STL, use optiOl-s wsdl2h-s-ocalc.hhttp://www.genivia.com/calc.wsdi To build a pure C application, use option-c wsdl2h-c-ocalc.hhttp://www.genivia.com/calc.wsd Important: Visual Studio users should make sure to compile all gSoap source files in C++ compilation mode. If you migrate to a project file. vcproj, please set CompileAs=2" in your vcproj file. We have not yet generated the stubs for the C/C++ API. To do so, run the soapcpp2 compiler soapcpp2-1-C-limport caIc h Option -i(and alternatively option -j) indicates that we want C++ proxy and server objects that include the client(and server)code, -C indicates client-side only files(soapcpp2 generates both client. and server stubs and skeletons by default. Option -I is needed to import the stlvector h file from the im port directory in the g SoaP package to support serialization of STL vectors SupposewedevelopaC+tclientforthecalculatorserviceusingwsdl2h-ocalc.hhttp://www.genivia.com/calc.wsdl and soapcpp2 -i-C calc. h We use the generaled soapcalc Proxy class and calc. nsmap XML namespace mapping table to access the Web service. The soapcalcP roxy class is a proxy to invoke the service

资源截图

代码片段和文件信息

评论

共有 条评论