xref: /PHP-5.5/ext/soap/php_soap.h (revision 73c1be26)
1 /*
2   +----------------------------------------------------------------------+
3   | PHP Version 5                                                        |
4   +----------------------------------------------------------------------+
5   | Copyright (c) 1997-2015 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 /* New SOAP SSL Method Constants */
153 #define SOAP_SSL_METHOD_TLS     0
154 #define SOAP_SSL_METHOD_SSLv2   1
155 #define SOAP_SSL_METHOD_SSLv3   2
156 #define SOAP_SSL_METHOD_SSLv23  3
157 
158 
159 ZEND_BEGIN_MODULE_GLOBALS(soap)
160 	HashTable  defEncNs;     /* mapping of default namespaces to prefixes */
161 	HashTable  defEnc;
162 	HashTable  defEncIndex;
163 	HashTable *typemap;
164 	int        cur_uniq_ns;
165 	int        soap_version;
166 	sdlPtr     sdl;
167 	zend_bool  use_soap_error_handler;
168 	char*      error_code;
169 	zval*      error_object;
170 	char       cache;
171 	char       cache_mode;
172 	char       cache_enabled;
173 	char*      cache_dir;
174 	long       cache_ttl;
175 	long       cache_limit;
176 	HashTable *mem_cache;
177 	xmlCharEncodingHandlerPtr encoding;
178 	HashTable *class_map;
179 	int        features;
180 	HashTable  wsdl_cache;
181 	int        cur_uniq_ref;
182 	HashTable *ref_map;
183 ZEND_END_MODULE_GLOBALS(soap)
184 
185 #ifdef ZTS
186 #include "TSRM.h"
187 #endif
188 
189 extern zend_module_entry soap_module_entry;
190 #define soap_module_ptr &soap_module_entry
191 #define phpext_soap_ptr soap_module_ptr
192 
193 ZEND_EXTERN_MODULE_GLOBALS(soap)
194 
195 #ifdef ZTS
196 # define SOAP_GLOBAL(v) TSRMG(soap_globals_id, zend_soap_globals *, v)
197 #else
198 # define SOAP_GLOBAL(v) (soap_globals.v)
199 #endif
200 
201 extern zend_class_entry* soap_var_class_entry;
202 
203 zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
204 
205 #define soap_error0(severity, format) \
206 	php_error(severity, "SOAP-ERROR: " format)
207 
208 #define soap_error1(severity, format, param1) \
209 	php_error(severity, "SOAP-ERROR: " format, param1)
210 
211 #define soap_error2(severity, format, param1, param2) \
212 	php_error(severity, "SOAP-ERROR: " format, param1, param2)
213 
214 #define soap_error3(severity, format, param1, param2, param3) \
215 	php_error(severity, "SOAP-ERROR: " format, param1, param2, param3)
216 
217 #endif
218