bfbc46c4ce9c06eef849f693d07eeaca6ebbe92e
[yaz-moved-to-github.git] / include / yaz / soap.h
1 /*
2  * Copyright (c) 2002-2003, Index Data.
3  * See the file LICENSE for details.
4  *
5  * $Id: soap.h,v 1.6 2004-01-07 20:36:44 adam Exp $
6  */
7
8 #ifndef YAZ_SOAP_H
9 #define YAZ_SOAP_H
10
11 #include <yaz/odr.h>
12
13 YAZ_BEGIN_CDECL
14
15 typedef struct {
16     char *fault_code;
17     char *fault_string;
18     char *details;
19 } Z_SOAP_Fault;
20
21 typedef struct {
22     int no;
23     char *ns;
24     void *p;
25 } Z_SOAP_Generic;
26
27 #define Z_SOAP_fault 1
28 #define Z_SOAP_generic 2
29 #define Z_SOAP_error 3
30 typedef struct {
31     int which;
32     union {
33         Z_SOAP_Fault   *fault;
34         Z_SOAP_Generic *generic;
35         Z_SOAP_Fault   *soap_error;
36     } u;
37     const char *ns;
38 } Z_SOAP;
39
40 typedef int (*Z_SOAP_fun)(ODR o, void * ptr, void **handler_data,
41                          void *client_data, const char *ns);
42 typedef struct {
43     char *ns;
44     void *client_data;
45     Z_SOAP_fun f;
46 } Z_SOAP_Handler;
47
48 YAZ_EXPORT int z_soap_codec(ODR o, Z_SOAP **pp, 
49                             char **content_buf, int *content_len,
50                             Z_SOAP_Handler *handlers);
51 YAZ_EXPORT int z_soap_codec_enc(ODR o, Z_SOAP **pp, 
52                                 char **content_buf, int *content_len,
53                                 Z_SOAP_Handler *handlers, const char *encoding,
54                                 const char *stylesheet);
55
56 YAZ_EXPORT int z_soap_error(ODR o, Z_SOAP *p,
57                             const char *fault_code, const char *fault_string,
58                             const char *details);
59
60 YAZ_END_CDECL
61 #endif