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