Use option -fPIC for g++
[yaz4j-moved-to-github.git] / dependencies / yaz_3.0.14 / doc / soap.xml.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>3. SOAP Packages</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2"><link rel="start" href="index.html" title="YAZ User's Guide and Reference"><link rel="up" href="soap.html" title="Chapter 8. SOAP and SRU"><link rel="prev" href="soap.http.html" title="2. HTTP"><link rel="next" href="soap.srw.html" title="4. SRU"></head><body><link rel="stylesheet" type="text/css" href="common/style1.css"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">3. SOAP Packages</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="soap.http.html">Prev</a> </td><th width="60%" align="center">Chapter 8. SOAP and SRU</th><td width="20%" align="right"> <a accesskey="n" href="soap.srw.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="soap.xml"></a>3. SOAP Packages</h2></div></div></div><p>
2       Every SOAP package in YAZ is represented as follows:
3       </p><pre class="synopsis">
4 #include &lt;yaz/soap.h&gt;
5
6 typedef struct {
7     char *fault_code;
8     char *fault_string;
9     char *details;
10 } Z_SOAP_Fault;
11
12 typedef struct {
13     int no;
14     char *ns;
15     void *p;
16 } Z_SOAP_Generic;
17
18 #define Z_SOAP_fault 1
19 #define Z_SOAP_generic 2
20 #define Z_SOAP_error 3
21 typedef struct {
22     int which;
23     union {
24         Z_SOAP_Fault   *fault;
25         Z_SOAP_Generic *generic;
26         Z_SOAP_Fault   *soap_error;
27     } u;
28     const char *ns;
29 } Z_SOAP;
30       </pre><p>
31     </p><p>
32       The <code class="literal">fault</code> and <code class="literal">soap_error</code>
33       arms represent both a SOAP fault - struct
34       <code class="literal">Z_SOAP_Fault</code>. Any other generic
35         (valid) package is represented by <code class="literal">Z_SOAP_Generic</code>.
36     </p><p>
37       The <code class="literal">ns</code> as part of <code class="literal">Z_SOAP</code>
38       is the namespace for SOAP itself and reflects the SOAP
39       version. For version 1.1 it is
40       <code class="literal">http://schemas.xmlsoap.org/soap/envelope/</code>,
41       for version 1.2 it is
42       <code class="literal">http://www.w3.org/2001/06/soap-envelope</code>.
43     </p><pre class="synopsis">
44 int z_soap_codec(ODR o, Z_SOAP **pp,
45                  char **content_buf, int *content_len,
46                  Z_SOAP_Handler *handlers);
47     </pre><p>
48       The <code class="literal">content_buf</code> and <code class="literal">content_len</code>
49       is XML buffer and length of buffer respectively.
50     </p><p>
51       The <code class="literal">handlers</code> is a list of SOAP codec
52       handlers - one handler for each service namespace. For SRU SOAP, the
53       namespace would be <code class="literal">http://www.loc.gov/zing/srw/v1.0/</code>.
54     </p><p>
55       When decoding, the <code class="function">z_soap_codec</code>
56       inspects the XML content
57       and tries to match one of the services namespaces of the
58       supplied handlers. If there is a match a handler function
59       is invoked which decodes that particular SOAP package.
60       If successful, the returned <code class="literal">Z_SOAP</code> package will be
61       of type <code class="literal">Z_SOAP_Generic</code>.
62       Member <code class="literal">no</code> is
63       set the offset of handler that matched; <code class="literal">ns</code>
64       is set to namespace of matching handler; the void pointer
65       <code class="literal">p</code> is set to the C data structure assocatiated
66       with the handler.
67     </p><p>
68       When a NULL namespace is met (member <code class="literal">ns</code> bwlow),
69       that specifies end-of-list.
70     </p><p>
71       Each handler is defined as follows:
72       </p><pre class="synopsis">
73 typedef struct {
74     char *ns;
75     void *client_data;
76     Z_SOAP_fun f;
77 } Z_SOAP_Handler;
78       </pre><p>
79       The <code class="literal">ns</code> is namespace of service associated with
80       handler <code class="literal">f</code>. <code class="literal">client_data</code>
81       is user-defined data which is passed to handler.
82     </p><p>
83       The prototype for a SOAP service handler is:
84       </p><pre class="synopsis">
85 int handler(ODR o, void * ptr, void **handler_data,
86             void *client_data, const char *ns);
87       </pre><p>
88       The <em class="parameter"><code>o</code></em> specifies the mode (decode/encode)
89       as usual. The second argument, <em class="parameter"><code>ptr</code></em>,
90       is a libxml2 tree node pointer (<code class="literal">xmlNodePtr</code>)
91       and is a pointer to the <code class="literal">Body</code> element
92       of the SOAP package. The <em class="parameter"><code>handler_data</code></em>
93       is an opaque pointer to a C definitions associated with the
94       SOAP service. <em class="parameter"><code>client_data</code></em> is the pointer
95       which was set as part of the <code class="literal">Z_SOAP_handler</code>.
96       Finally, <em class="parameter"><code>ns</code></em> the service namespace.
97     </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="soap.http.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="soap.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="soap.srw.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">2. HTTP </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> 4. SRU</td></tr></table></div></body></html>