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