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