comparison GEMBASSY-1.0.3/gsoap/custom/README.txt @ 2:8947fca5f715 draft default tip

Uploaded
author ktnyt
date Fri, 26 Jun 2015 05:21:44 -0400
parents 84a17b3fad1f
children
comparison
equal deleted inserted replaced
1:84a17b3fad1f 2:8947fca5f715
1
2 OVERVIEW
3
4 This directory contains custom serializers for common data types.
5
6 CONTENTS
7
8 Custom serializers replace the soapcpp2-generated serialization routines.
9 See the notes in the source files on specific usage.
10
11 The following serializers are available:
12
13 long_double.* Serializes long double (extended double) type
14 struct_tm.* Serializes <time.h> struct tm
15 struct_timeval.* Serializes struct timeval (precision in usec)
16 duration.* Serializes LONG64 values as xsd:duration
17
18 USAGE
19
20 To use a custom serializer add an import statement to your gSOAP header file:
21
22 #import "struct_tm.h"
23
24 This replaces time_t for xsd__dateTime by struct tm. You can use xsd__dateTime
25 as XML elements and attributes:
26
27 struct ns__example
28 { @xsd__dateTime start; // attribute
29 xsd__dateTime end; // element
30 };
31
32 Then compile with soapcpp2 and cc and link struct_tm.c
33
34 HOW TO MODIFY TYPEMAP.DAT TO AUTOMATE THE MAPPING TO A CUSTOM TYPE WITH WSDL2H
35
36 The mapping is specified in typemap.dat as follows:
37
38 xsd__dateTime = #import "custom/struct_tm.h"
39
40 which maps xsd:dateTime to struct tm when wsdl2h is applied to a WSDL.
41
42 xsd__decimal = #import "custom/long_double.h" | long double
43
44 this maps xsd:decimal to long double (the column after | specifies usage).
45
46 IMPLEMENTING YOUR OWN CUSTOM SERIALIZERS
47
48 To build your own custom serializers: a custom serializer is typically declared
49 in the imported file as follows
50
51 extern typedef Type X;
52
53 To implement custom serializers you should implement the following routines:
54
55 void soap_default_X(struct soap*, X*);
56 sets default values for X
57 void soap_serialize_X(struct soap*, const X*);
58 analyzes X for id-ref serialization (maybe empty)
59 int soap_out_X(struct soap*, const char *tag, int id, const X*, const char *type);
60 emits X in XML as <tag xsi:type=type> (type is optional)
61 X *soap_in_X(struct soap*, const char *tag, X*, const char *type);
62 parses X from XML as <tag xsi:type=type>
63
64 To support XML attribute serialization, you should also define:
65
66 int soap_s2X(struct soap*, const char *value, X*);
67 converts string to X and returns SOAP_OK
68 const char *soap_X2s(struct soap*, X);
69 converts X to string (or NULL when error)