php_soap.h 9.2 KB

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