• Home
  • History
  • Annotate
  • only in this directory
NameDateSize

..16-May-201743

.deps/H16-May-20177

calc.hH A D07-Jun-20164.2 KiB

calcclient.cH A D07-Jun-20162.6 KiB

calcserver.cH A D07-Jun-20163.4 KiB

MakefileH A D07-Jun-201616.2 KiB

Makefile.amH A D07-Jun-2016618

Makefile.inH A D07-Jun-201615.8 KiB

README.txtH A D07-Jun-20165.7 KiB

README.txt

1Simple calculator service implements:
2
3   add(a,b)
4   sub(a,b)
5   mul(a,b)
6   div(a,b)
7   pow(a,b)
8
9Compilation in C (see samples/calc):
10    soapcpp2 -c calc.h
11    cc -o calcclient calcclient.c stdsoap2.c soapC.c soapClient.c
12    cc -o calcserver calcserver.c stdsoap2.c soapC.c soapServer.c
13
14Compilation in C++ (see samples/calc++):
15    soapcpp2 -i calc.h
16    cc -o calcclient++ calcclient.cpp stdsoap2.cpp soapC.cpp soapcalcProxy.cpp
17    cc -o calcserver++ calcserver.cpp stdsoap2.cpp soapC.cpp soapcalcService.cpp
18
19For C++ development soapcpp2 option -i generates proxy and service classes,
20which encapsulate the method operations in the class instead of defining them
21as global functions as in C.
22
23The calcclient application invokes the service and is used from the command
24line as follows:
25
26$ calcclient add 3 4
27result = 7
28
29The calcserver application is a CGI application that can be installed under the
30cgibin of your Web server.
31
32The C client-side uses:
33
34  Initialization of the runtime engine:
35    soap_init(struct soap*)
36  Invoking a call of xyz, this function is generated by soapcpp2:
37    soap_call_ns__xyz(struct soap*, const char *endpoint, const char *action,
38                      double a, double b, double *result)
39    Note: endpoint=NULL and action=NULL for defaults
40  Print communication errors:
41    soap_print_fault(struct soap*, FILE*)
42  Allocate data, which stays alive until deallocated by soap_end()
43    soap_malloc(struct soap*, size_t len)
44  Delete deserialized data:
45    soap_end(struct soap*)
46  Finalize and detach the runtime engine:
47    soap_done(struct soap*)
48
49The C server-side uses:
50
51  Initialization of the runtime engine:
52    soap_init(struct soap*)
53  Binding the port:
54    soap_bind(struct soap*, const char *host, int port, int backlog)
55  Accepting a request:
56    soap_accept(struct soap*);
57  Invoking the service dispatcher, this function is generated by soapcpp2:
58    soap_serve(struct soap*)
59  Print communication errors:
60    soap_print_fault(struct soap*, FILE*)
61  Allocate data, which stays alive until deallocated by soap_end()
62    soap_malloc(struct soap*, size_t len)
63  Delete deserialized data:
64    soap_end(struct soap*)
65  Send back sender-related fault:
66    soap_sender_fault(struct soap*, const char *string, const char *detailXML)
67  Send back receiver-related fault:
68    soap_receiver_fault(struct soap*, const char *string, const char *detailXML)
69  Finalize and detach the runtime engine:
70    soap_done(struct soap*)
71  Service operations are not auto-generated (user-defined):
72    ns__add(struct soap*, double a, double b, double *result)
73    ns__sub(struct soap*, double a, double b, double *result)
74    ns__mul(struct soap*, double a, double b, double *result)
75    ns__div(struct soap*, double a, double b, double *result)
76    ns__pow(struct soap*, double a, double b, double *result)
77
78The C++ client-side uses a proxy generated with soapcpp2 -i: class calcProxy
79
80  The default endpoint can be changed:
81    const char *calcProxxy::endpoint
82  Invoke a call of xyz:
83    calcProxy::xyz(double a, double b, double *result)
84  Print communication errors:
85    calcProxy::soap_stream_fault(std::ostream&)
86  Error code (see list of error codes in documentation and stdsoap2.h):
87    calcProxy::error
88  Allocate data, deallocated by soap_end() or calcProxy destructor
89    soap_malloc(calcProxy*, size_t len)
90  Get new instance of class X, deallocated by soap_destroy() or calcProxy destructor
91    soap_new_X(calcProxy*, -1)
92  Get array of new instances of class X, deallocated by soap_destroy() or calcProxy destructor
93    soap_new_X(calcProxy*, arraylen)
94  Delete deserialized C++ class instances (also part of calcProxy destructor):
95    soap_destroy(calcProxy*)
96  Delete deserialized data (also part of calcProxy destructor):
97    soap_end(calcProxy*)
98
99The C++ server-side uses a class generated with soapcpp2 -i: class calcService
100
101  Serve requests over stdin/out (for CGI)
102    calcService::serve()
103  Serve multiple requests over port (iterative HTTP server):
104    calcService::run()
105  Print communication errors:
106    calcService::soap_stream_fault(std::ostream&)
107  Error code (see list of error codes in documentation and stdsoap2.h):
108    calcService::error
109  Send back sender-related fault:
110    calcService::soap_senderfault(const char *string, const char *detailXML)
111  Send back sender-related fault with subcode (SOAP 1.2):
112    calcService::soap_senderfault(const char *subcodeQName, const char *string, const char *detailXML)
113  Send back receiver-related fault:
114    calcService::soap_receiver_fault(const char *string, const char *detailXML)
115  Send back receiver-related fault with subcode (SOAP 1.2):
116    calcService::soap_receiver_fault(const char *subcodeQName, const char *string, const char *detailXML)
117  Service operations are user-defined (not auto-generated):
118    calcService::add(double a, double b, double *result)
119    calcService::sub(double a, double b, double *result)
120    calcService::mul(double a, double b, double *result)
121    calcService::div(double a, double b, double *result)
122    calcService::pow(double a, double b, double *result)
123  Allocate data, deallocated by soap_end() or calcService destructor
124    soap_malloc(calcService*, size_t len)
125  Get new instance of class X, deallocated by soap_destroy() or calcService destructor
126    soap_new_X(calcService*, -1)
127  Get array of new instances of class X, deallocated by soap_destroy() or calcService destructor
128    soap_new_X(calcService*, arraylen)
129  Delete deserialized C++ class instances (also part of calcService destructor):
130    soap_destroy(calcService*)
131  Delete deserialized data (also part of calcService destructor):
132    soap_end(calcService*)
133
134Note: all soap_xyz(struct soap*, ...) gSOAP API functions are also available
135to the calcProxy and calcService classes by inheritance of the struct soap
136runtime engine state object.
137