xref: /PHP-5.3/ext/soap/php_soap.h (revision a2045ff3)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2013 The PHP Group                                |
6   +----------------------------------------------------------------------+
7   | This source file is subject to version 3.01 of the PHP license,      |
8   | that is bundled with this package in the file LICENSE, and is        |
9   | available through the world-wide-web at the following url:           |
10   | http://www.php.net/license/3_01.txt                                  |
11   | If you did not receive a copy of the PHP license and are unable to   |
12   | obtain it through the world-wide-web, please send a note to          |
13   | license@php.net so we can mail you a copy immediately.               |
14   +----------------------------------------------------------------------+
15   | Authors: Brad Lafountain <rodif_bl@yahoo.com>                        |
16   |          Shane Caraveo <shane@caraveo.com>                           |
17   |          Dmitry Stogov <dmitry@zend.com>                             |
18   +----------------------------------------------------------------------+
19 */
20 /* $Id$ */
21 
22 #ifndef PHP_SOAP_H
23 #define PHP_SOAP_H
24 
25 #include "php.h"
26 #include "php_globals.h"
27 #include "ext/standard/info.h"
28 #include "ext/standard/php_standard.h"
29 #if HAVE_PHP_SESSION && !defined(COMPILE_DL_SESSION)
30 #include "ext/session/php_session.h"
31 #endif
32 #include "ext/standard/php_smart_str.h"
33 #include "php_ini.h"
34 #include "SAPI.h"
35 #include <libxml/parser.h>
36 #include <libxml/xpath.h>
37 
38 #ifndef PHP_HAVE_STREAMS
39 # error You lose - must be compiled against PHP 4.3.0 or later
40 #endif
41 
42 #ifndef PHP_WIN32
43 # define TRUE 1
44 # define FALSE 0
45 # define stricmp strcasecmp
46 #endif
47 
48 extern int le_url;
49 
50 typedef struct _encodeType encodeType, *encodeTypePtr;
51 typedef struct _encode encode, *encodePtr;
52 
53 typedef struct _sdl sdl, *sdlPtr;
54 typedef struct _sdlRestrictionInt sdlRestrictionInt, *sdlRestrictionIntPtr;
55 typedef struct _sdlRestrictionChar sdlRestrictionChar, *sdlRestrictionCharPtr;
56 typedef struct _sdlRestrictions sdlRestrictions, *sdlRestrictionsPtr;
57 typedef struct _sdlType sdlType, *sdlTypePtr;
58 typedef struct _sdlParam sdlParam, *sdlParamPtr;
59 typedef struct _sdlFunction sdlFunction, *sdlFunctionPtr;
60 typedef struct _sdlAttribute sdlAttribute, *sdlAttributePtr;
61 typedef struct _sdlBinding sdlBinding, *sdlBindingPtr;
62 typedef struct _sdlSoapBinding sdlSoapBinding, *sdlSoapBindingPtr;
63 typedef struct _sdlSoapBindingFunction sdlSoapBindingFunction, *sdlSoapBindingFunctionPtr;
64 typedef struct _sdlSoapBindingFunctionBody sdlSoapBindingFunctionBody, *sdlSoapBindingFunctionBodyPtr;
65 
66 typedef struct _soapMapping soapMapping, *soapMappingPtr;
67 typedef struct _soapService soapService, *soapServicePtr;
68 
69 #include "php_xml.h"
70 #include "php_encoding.h"
71 #include "php_sdl.h"
72 #include "php_schema.h"
73 #include "php_http.h"
74 #include "php_packet_soap.h"
75 
76 struct _soapMapping {
77 	zval *to_xml;
78 	zval *to_zval;
79 };
80 
81 struct _soapHeader;
82 
83 struct _soapService {
84 	sdlPtr sdl;
85 
86 	struct _soap_functions {
87 		HashTable *ft;
88 		int functions_all;
89 	} soap_functions;
90 
91 	struct _soap_class {
92 		zend_class_entry *ce;
93 		zval **argv;
94 		int argc;
95 		int persistance;
96 	} soap_class;
97 
98 	zval *soap_object;
99 
100 	HashTable *typemap;
101 	int        version;
102 	int        type;
103 	char      *actor;
104 	char      *uri;
105 	xmlCharEncodingHandlerPtr encoding;
106 	HashTable *class_map;
107 	int        features;
108 	struct _soapHeader **soap_headers_ptr;
109 	int send_errors;
110 };
111 
112 #define SOAP_CLASS 1
113 #define SOAP_FUNCTIONS 2
114 #define SOAP_OBJECT 3
115 #define SOAP_FUNCTIONS_ALL 999
116 
117 #define SOAP_MAP_FUNCTION 1
118 #define SOAP_MAP_CLASS 2
119 
120 #define SOAP_PERSISTENCE_SESSION 1
121 #define SOAP_PERSISTENCE_REQUEST 2
122 
123 #define SOAP_1_1 1
124 #define SOAP_1_2 2
125 
126 #define SOAP_ACTOR_NEXT             1
127 #define SOAP_ACTOR_NONE             2
128 #define SOAP_ACTOR_UNLIMATERECEIVER 3
129 
130 #define SOAP_1_1_ACTOR_NEXT             "http://schemas.xmlsoap.org/soap/actor/next"
131 
132 #define SOAP_1_2_ACTOR_NEXT             "http://www.w3.org/2003/05/soap-envelope/role/next"
133 #define SOAP_1_2_ACTOR_NONE             "http://www.w3.org/2003/05/soap-envelope/role/none"
134 #define SOAP_1_2_ACTOR_UNLIMATERECEIVER "http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver"
135 
136 #define SOAP_COMPRESSION_ACCEPT  0x20
137 #define SOAP_COMPRESSION_GZIP    0x00
138 #define SOAP_COMPRESSION_DEFLATE 0x10
139 
140 #define SOAP_AUTHENTICATION_BASIC   0
141 #define SOAP_AUTHENTICATION_DIGEST  1
142 
143 #define SOAP_SINGLE_ELEMENT_ARRAYS  (1<<0)
144 #define SOAP_WAIT_ONE_WAY_CALLS     (1<<1)
145 #define SOAP_USE_XSI_ARRAY_TYPE     (1<<2)
146 
147 #define WSDL_CACHE_NONE     0x0
148 #define WSDL_CACHE_DISK     0x1
149 #define WSDL_CACHE_MEMORY   0x2
150 #define WSDL_CACHE_BOTH     0x3
151 
152 ZEND_BEGIN_MODULE_GLOBALS(soap)
153 	HashTable  defEncNs;     /* mapping of default namespaces to prefixes */
154 	HashTable  defEnc;
155 	HashTable  defEncIndex;
156 	HashTable *typemap;
157 	int        cur_uniq_ns;
158 	int        soap_version;
159 	sdlPtr     sdl;
160 	zend_bool  use_soap_error_handler;
161 	char*      error_code;
162 	zval*      error_object;
163 	char       cache;
164 	char       cache_mode;
165 	char       cache_enabled;
166 	char*      cache_dir;
167 	long       cache_ttl;
168 	long       cache_limit;
169 	HashTable *mem_cache;
170 	xmlCharEncodingHandlerPtr encoding;
171 	HashTable *class_map;
172 	int        features;
173 	HashTable  wsdl_cache;
174 	int        cur_uniq_ref;
175 	HashTable *ref_map;
176 ZEND_END_MODULE_GLOBALS(soap)
177 
178 #ifdef ZTS
179 #include "TSRM.h"
180 #endif
181 
182 extern zend_module_entry soap_module_entry;
183 #define soap_module_ptr &soap_module_entry
184 #define phpext_soap_ptr soap_module_ptr
185 
186 ZEND_EXTERN_MODULE_GLOBALS(soap)
187 
188 #ifdef ZTS
189 # define SOAP_GLOBAL(v) TSRMG(soap_globals_id, zend_soap_globals *, v)
190 #else
191 # define SOAP_GLOBAL(v) (soap_globals.v)
192 #endif
193 
194 extern zend_class_entry* soap_var_class_entry;
195 
196 zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
197 
198 #define soap_error0(severity, format) \
199 	php_error(severity, "SOAP-ERROR: " format)
200 
201 #define soap_error1(severity, format, param1) \
202 	php_error(severity, "SOAP-ERROR: " format, param1)
203 
204 #define soap_error2(severity, format, param1, param2) \
205 	php_error(severity, "SOAP-ERROR: " format, param1, param2)
206 
207 #define soap_error3(severity, format, param1, param2, param3) \
208 	php_error(severity, "SOAP-ERROR: " format, param1, param2, param3)
209 
210 #endif
211