mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
WSDL: support for multiple services/ports/bindings was implemented
This commit is contained in:
parent
4573a562a3
commit
98ff80dba9
10 changed files with 393 additions and 728 deletions
|
@ -111,6 +111,9 @@ WSDL
|
|||
- function/method overloading (test(int); test(string))
|
||||
- wsdl caching
|
||||
- wsdl auto generation
|
||||
? SOAP binding
|
||||
- HTTP GET/POST binding
|
||||
- MIME binding
|
||||
|
||||
Error Handling
|
||||
--------------
|
||||
|
@ -127,6 +130,7 @@ Transport
|
|||
- transport abstraction layer
|
||||
? SoapAction HTTP header field
|
||||
? HTTP status codes
|
||||
? HTTP chunked Transfer-Encoding
|
||||
|
||||
UDDI
|
||||
----
|
||||
|
|
|
@ -2,6 +2,49 @@
|
|||
|
||||
#include "php_soap.h"
|
||||
|
||||
/* zval type decode */
|
||||
static zval *to_zval_double(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_long(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_ulong(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_bool(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_string(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_stringr(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_stringc(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_map(encodeType type, xmlNodePtr data);
|
||||
static zval *to_zval_null(encodeType type, xmlNodePtr data);
|
||||
|
||||
static xmlNodePtr to_xml_long(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_ulong(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_double(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_bool(encodeType type, zval *data, int style);
|
||||
|
||||
/* String encode */
|
||||
static xmlNodePtr to_xml_string(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style);
|
||||
|
||||
/* Null encode */
|
||||
static xmlNodePtr to_xml_null(encodeType type, zval *data, int style);
|
||||
|
||||
/* Struct encode */
|
||||
static xmlNodePtr to_xml_object(encodeType type, zval *data, int style);
|
||||
|
||||
/* Array encode */
|
||||
static xmlNodePtr guess_array_map(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_array(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_map(encodeType type, zval *data, int style);
|
||||
|
||||
/* Datetime encode/decode */
|
||||
static xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style);
|
||||
static xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_time(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_date(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_gday(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style);
|
||||
static xmlNodePtr to_xml_duration(encodeType type, zval *data, int style);
|
||||
|
||||
encode defaultEncoding[] = {
|
||||
{{UNKNOWN_TYPE, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert},
|
||||
|
||||
|
@ -277,7 +320,7 @@ zval *to_zval_after_user(encodeType type, zval *data)
|
|||
|
||||
/* TODO: get rid of "bogus".. ither by passing in the already created xmlnode or passing in the node name */
|
||||
/* String encode/decode */
|
||||
zval *to_zval_string(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_string(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -290,7 +333,7 @@ zval *to_zval_string(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
zval *to_zval_stringr(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_stringr(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -304,7 +347,7 @@ zval *to_zval_stringr(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
zval *to_zval_stringc(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_stringc(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -318,7 +361,7 @@ zval *to_zval_stringc(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_string(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_string(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
char *str, *pstr;
|
||||
|
@ -352,7 +395,7 @@ xmlNodePtr to_xml_string(encodeType type, zval *data, int style)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
|
||||
|
@ -376,7 +419,7 @@ xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style)
|
|||
return ret;
|
||||
}
|
||||
|
||||
zval *to_zval_double(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_double(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -391,7 +434,7 @@ zval *to_zval_double(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
zval *to_zval_long(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_long(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -406,7 +449,7 @@ zval *to_zval_long(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
zval *to_zval_ulong(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_ulong(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -422,7 +465,7 @@ zval *to_zval_ulong(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
zval tmp;
|
||||
|
@ -445,7 +488,7 @@ xmlNodePtr to_xml_long(encodeType type, zval *data, int style)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_ulong(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_ulong(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
zval tmp;
|
||||
|
@ -469,7 +512,7 @@ xmlNodePtr to_xml_ulong(encodeType type, zval *data, int style)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_double(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_double(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
zval tmp;
|
||||
|
@ -492,7 +535,7 @@ xmlNodePtr to_xml_double(encodeType type, zval *data, int style)
|
|||
return ret;
|
||||
}
|
||||
|
||||
zval *to_zval_bool(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_bool(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -513,7 +556,7 @@ zval *to_zval_bool(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_bool(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_bool(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
zval tmp;
|
||||
|
@ -545,7 +588,7 @@ xmlNodePtr to_xml_bool(encodeType type, zval *data, int style)
|
|||
}
|
||||
|
||||
/* Null encode/decode */
|
||||
zval *to_zval_null(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_null(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
MAKE_STD_ZVAL(ret);
|
||||
|
@ -553,7 +596,7 @@ zval *to_zval_null(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_null(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_null(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr ret;
|
||||
|
||||
|
@ -615,7 +658,7 @@ zval *to_zval_object(encodeType type, xmlNodePtr data)
|
|||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr xmlParam;
|
||||
HashTable *prop;
|
||||
|
@ -662,7 +705,7 @@ xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
|||
smart_str_free(ns);
|
||||
efree(ns);
|
||||
}
|
||||
} else {
|
||||
} else if (Z_TYPE_P(data) == IS_OBJECT) {
|
||||
xmlParam = xmlNewNode(NULL, "BOGUS");
|
||||
FIND_ZVAL_NULL(data, xmlParam, style);
|
||||
|
||||
|
@ -697,7 +740,7 @@ xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
|||
}
|
||||
|
||||
/* Array encode/decode */
|
||||
xmlNodePtr guess_array_map(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr guess_array_map(encodeType type, zval *data, int style)
|
||||
{
|
||||
encodePtr enc = NULL;
|
||||
TSRMLS_FETCH();
|
||||
|
@ -716,7 +759,7 @@ xmlNodePtr guess_array_map(encodeType type, zval *data, int style)
|
|||
return master_to_xml(enc, data, style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_array(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_array(encodeType type, zval *data, int style)
|
||||
{
|
||||
smart_str array_type_and_size = {0}, array_type = {0};
|
||||
int i;
|
||||
|
@ -763,9 +806,9 @@ xmlNodePtr to_xml_array(encodeType type, zval *data, int style)
|
|||
xmlAddChild(xmlParam, xparam);
|
||||
zend_hash_move_forward(data->value.ht);
|
||||
}
|
||||
}
|
||||
if (style == SOAP_ENCODED) {
|
||||
set_ns_and_type(xmlParam, type);
|
||||
if (style == SOAP_ENCODED) {
|
||||
set_ns_and_type(xmlParam, type);
|
||||
}
|
||||
}
|
||||
return xmlParam;
|
||||
}
|
||||
|
@ -934,7 +977,7 @@ zval *to_zval_array(encodeType type, xmlNodePtr data)
|
|||
}
|
||||
|
||||
/* Map encode/decode */
|
||||
xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr xmlParam;
|
||||
int i;
|
||||
|
@ -989,15 +1032,15 @@ xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
|
|||
}
|
||||
zend_hash_move_forward(data->value.ht);
|
||||
}
|
||||
}
|
||||
if (style == SOAP_ENCODED) {
|
||||
set_ns_and_type(xmlParam, type);
|
||||
if (style == SOAP_ENCODED) {
|
||||
set_ns_and_type(xmlParam, type);
|
||||
}
|
||||
}
|
||||
|
||||
return xmlParam;
|
||||
}
|
||||
|
||||
zval *to_zval_map(encodeType type, xmlNodePtr data)
|
||||
static zval *to_zval_map(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret, *key, *value;
|
||||
xmlNodePtr trav, item, xmlKey, xmlValue;
|
||||
|
@ -1106,7 +1149,7 @@ zval *guess_zval_convert(encodeType type, xmlNodePtr data)
|
|||
}
|
||||
|
||||
/* Time encode/decode */
|
||||
xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style)
|
||||
static xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style)
|
||||
{
|
||||
/* logic hacked from ext/standard/datetime.c */
|
||||
struct tm *ta, tmbuf;
|
||||
|
@ -1167,49 +1210,49 @@ xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int sty
|
|||
return xmlParam;
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_duration(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_duration(encodeType type, zval *data, int style)
|
||||
{
|
||||
/* TODO: '-'?P([0-9]+Y)?([0-9]+M)?([0-9]+D)?T([0-9]+H)?([0-9]+M)?([0-9]+S)? */
|
||||
return to_xml_string(type, data, style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style)
|
||||
{
|
||||
return to_xml_datetime_ex(type, data, "%Y-%m-%dT%H:%M:%S", style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_time(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_time(encodeType type, zval *data, int style)
|
||||
{
|
||||
/* TODO: microsecconds */
|
||||
return to_xml_datetime_ex(type, data, "%H:%M:%S", style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_date(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_date(encodeType type, zval *data, int style)
|
||||
{
|
||||
return to_xml_datetime_ex(type, data, "%Y-%m-%d", style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style)
|
||||
{
|
||||
return to_xml_datetime_ex(type, data, "%Y-%m", style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style)
|
||||
{
|
||||
return to_xml_datetime_ex(type, data, "%Y", style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style)
|
||||
{
|
||||
return to_xml_datetime_ex(type, data, "--%m-%d", style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_gday(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_gday(encodeType type, zval *data, int style)
|
||||
{
|
||||
return to_xml_datetime_ex(type, data, "---%d", style);
|
||||
}
|
||||
|
||||
xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style)
|
||||
static xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style)
|
||||
{
|
||||
return to_xml_datetime_ex(type, data, "--%m--", style);
|
||||
}
|
||||
|
|
|
@ -171,55 +171,13 @@ zval *to_zval_after_user(encodeType type, zval *data);
|
|||
void whiteSpace_replace(char* str);
|
||||
void whiteSpace_collapse(char* str);
|
||||
|
||||
/* zval type decode */
|
||||
zval *to_zval_double(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_long(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_ulong(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_bool(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_object(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_string(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_stringr(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_stringc(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_array(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_map(encodeType type, xmlNodePtr data);
|
||||
zval *to_zval_null(encodeType type, xmlNodePtr data);
|
||||
zval *guess_zval_convert(encodeType type, xmlNodePtr data);
|
||||
|
||||
xmlNodePtr to_xml_long(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_ulong(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_double(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_bool(encodeType type, zval *data, int style);
|
||||
|
||||
/* String encode */
|
||||
xmlNodePtr to_xml_string(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_stringl(encodeType type, zval *data, int style);
|
||||
|
||||
/* Null encode */
|
||||
xmlNodePtr to_xml_null(encodeType type, zval *data, int style);
|
||||
|
||||
/* Struct encode */
|
||||
xmlNodePtr to_xml_object(encodeType type, zval *data, int style);
|
||||
|
||||
/* Array encode */
|
||||
xmlNodePtr guess_array_map(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_array(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_map(encodeType type, zval *data, int style);
|
||||
|
||||
/* Try and guess for non-wsdl clients and servers */
|
||||
zval *guess_zval_convert(encodeType type, xmlNodePtr data);
|
||||
xmlNodePtr guess_xml_convert(encodeType type, zval *data, int style);
|
||||
|
||||
/* Datetime encode/decode */
|
||||
xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style);
|
||||
xmlNodePtr to_xml_datetime(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_time(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_date(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gyearmonth(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gyear(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gmonthday(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gday(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_gmonth(encodeType type, zval *data, int style);
|
||||
xmlNodePtr to_xml_duration(encodeType type, zval *data, int style);
|
||||
|
||||
#define get_conversion(e) get_conversion_ex(SOAP_GLOBAL(defEncIndex), e)
|
||||
#define get_conversion_from_type(n, t) get_conversion_from_type_ex(SOAP_GLOBAL(defEnc), n, t)
|
||||
#define get_conversion_from_href_type(t) get_conversion_from_href_type_ex(SOAP_GLOBAL(defEnc), t, strlen(t))
|
||||
|
|
|
@ -8,19 +8,24 @@ static int get_http_headers(php_stream *socketd,char **response, int *out_size T
|
|||
#define smart_str_append_const(str, const) \
|
||||
smart_str_appendl(str,const,sizeof(const)-1)
|
||||
|
||||
int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_DC)
|
||||
int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *soapaction TSRMLS_DC)
|
||||
{
|
||||
xmlChar *buf;
|
||||
smart_str soap_headers = {0};
|
||||
int buf_size,err,ret;
|
||||
sdlPtr sdl;
|
||||
int buf_size,err;
|
||||
php_url *phpurl = NULL;
|
||||
php_stream *stream;
|
||||
zval **trace;
|
||||
zval **trace, **tmp;
|
||||
|
||||
FETCH_THIS_SOCKET(stream);
|
||||
FETCH_THIS_URL(phpurl);
|
||||
FETCH_THIS_SDL(sdl);
|
||||
if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"), (void **)&tmp) == SUCCESS) {
|
||||
php_stream_from_zval_no_verify(stream,tmp);
|
||||
} else {
|
||||
stream = NULL;
|
||||
}
|
||||
|
||||
xmlDocDumpMemory(doc, &buf, &buf_size);
|
||||
if (!buf) {
|
||||
|
@ -49,33 +54,17 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_
|
|||
}
|
||||
}
|
||||
|
||||
if (location != NULL && location[0] != '\000') {
|
||||
phpurl = php_url_parse(location);
|
||||
}
|
||||
if (phpurl == NULL) {
|
||||
xmlFree(buf);
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Unable to parse URL", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!stream) {
|
||||
char *url;
|
||||
int use_ssl;
|
||||
|
||||
if (!sdl) {
|
||||
zval **location;
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &location) == FAILURE) {
|
||||
xmlFree(buf);
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Error could not find location", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
url = Z_STRVAL_PP(location);
|
||||
} else {
|
||||
sdlBindingPtr binding;
|
||||
FETCH_THIS_PORT(binding);
|
||||
url = binding->location;
|
||||
}
|
||||
|
||||
if (url[0] != '\000') {
|
||||
phpurl = php_url_parse(url);
|
||||
}
|
||||
if (phpurl == NULL) {
|
||||
xmlFree(buf);
|
||||
add_soap_fault(this_ptr, "SOAP-ENV:Client", "Unable to parse URL", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
use_ssl = strcmp(phpurl->scheme, "https") == 0;
|
||||
if (use_ssl && php_stream_locate_url_wrapper("https://", NULL, STREAM_LOCATE_WRAPPERS_ONLY TSRMLS_CC) == NULL) {
|
||||
xmlFree(buf);
|
||||
|
@ -119,9 +108,6 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_
|
|||
if (stream) {
|
||||
php_stream_auto_cleanup(stream);
|
||||
add_property_resource(this_ptr, "httpsocket", php_stream_get_resource_id(stream));
|
||||
ret = zend_list_insert(phpurl, le_url);
|
||||
add_property_resource(this_ptr, "httpurl", ret);
|
||||
zend_list_addref(ret);
|
||||
} else {
|
||||
xmlFree(buf);
|
||||
php_url_free(phpurl);
|
||||
|
@ -150,7 +136,6 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_
|
|||
smart_str_append_long(&soap_headers, buf_size);
|
||||
smart_str_append_const(&soap_headers, "\r\n"
|
||||
"SOAPAction: \"");
|
||||
/* TODO: need to grab soap action from wsdl....*/
|
||||
smart_str_appends(&soap_headers, soapaction);
|
||||
smart_str_append_const(&soap_headers, "\"\r\n");
|
||||
|
||||
|
@ -203,6 +188,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_
|
|||
|
||||
err = php_stream_write(stream, soap_headers.c, soap_headers.len);
|
||||
if (err != soap_headers.len) {
|
||||
php_url_free(phpurl);
|
||||
xmlFree(buf);
|
||||
smart_str_free(&soap_headers);
|
||||
php_stream_close(stream);
|
||||
|
@ -213,6 +199,7 @@ int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_
|
|||
smart_str_free(&soap_headers);
|
||||
|
||||
}
|
||||
php_url_free(phpurl);
|
||||
xmlFree(buf);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -221,14 +208,18 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
|
|||
{
|
||||
char *http_headers, *http_body, *content_type, *http_version, http_status[4], *cookie_itt;
|
||||
int http_header_size, http_body_size, http_close;
|
||||
zval **socket_ref;
|
||||
php_stream *stream;
|
||||
zval **trace;
|
||||
zval **trace, **tmp;
|
||||
char* connection;
|
||||
int http_1_1 = 0;
|
||||
|
||||
if (FIND_SOCKET_PROPERTY(this_ptr, socket_ref) != FAILURE) {
|
||||
FETCH_SOCKET_RES(stream, socket_ref);
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"), (void **)&tmp) == SUCCESS) {
|
||||
php_stream_from_zval_no_verify(stream,tmp);
|
||||
} else {
|
||||
stream = NULL;
|
||||
}
|
||||
if (stream == NULL) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC)) {
|
||||
|
@ -299,9 +290,6 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
|
|||
add_property_stringl(this_ptr, "__last_response", http_body, http_body_size, 1);
|
||||
}
|
||||
|
||||
/* Close every time right now till i can spend more time on it
|
||||
it works.. it's just slower??
|
||||
*/
|
||||
/* See if the server requested a close */
|
||||
http_close = TRUE;
|
||||
connection = get_http_header_value(http_headers,"Connection: ");
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#ifndef PHP_HTTP_H
|
||||
#define PHP_HTTP_H
|
||||
|
||||
int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *soapaction TSRMLS_DC);
|
||||
int send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *location, char *soapaction TSRMLS_DC);
|
||||
int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS_DC);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -124,7 +124,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
|||
char *name, *ns = NULL;
|
||||
zval* tmp;
|
||||
|
||||
if (fn->bindingType == BINDING_SOAP) {
|
||||
if (fn->binding->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
|
||||
int res_count = zend_hash_num_elements(fn->responseParameters);
|
||||
|
||||
|
|
|
@ -1,5 +1,18 @@
|
|||
#include "php_soap.h"
|
||||
|
||||
typedef struct sdlCtx {
|
||||
sdlPtr root;
|
||||
HashTable messages;
|
||||
HashTable bindings;
|
||||
HashTable portTypes;
|
||||
HashTable services;
|
||||
} sdlCtx;
|
||||
|
||||
static void delete_binding(void *binding);
|
||||
static void delete_function(void *function);
|
||||
static void delete_paramater(void *paramater);
|
||||
static void delete_document(void *doc_ptr);
|
||||
|
||||
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const char *type)
|
||||
{
|
||||
encodePtr enc = NULL;
|
||||
|
@ -102,77 +115,9 @@ encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const char *ns, const
|
|||
return enc;
|
||||
}
|
||||
|
||||
zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data)
|
||||
{
|
||||
sdlTypePtr type;
|
||||
|
||||
type = enc.sdl_type;
|
||||
if (type->encode) {
|
||||
if (type->encode->details.type == IS_ARRAY ||
|
||||
type->encode->details.type == SOAP_ENC_ARRAY) {
|
||||
return to_zval_array(enc, data);
|
||||
} else if (type->encode->details.type == IS_OBJECT ||
|
||||
type->encode->details.type == SOAP_ENC_OBJECT) {
|
||||
return to_zval_object(enc, data);
|
||||
} else {
|
||||
if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
|
||||
return master_to_zval(type->encode, data);
|
||||
} else {
|
||||
TSRMLS_FETCH();
|
||||
return master_to_zval(get_conversion(UNKNOWN_TYPE), data);
|
||||
}
|
||||
}
|
||||
} else if (type->elements) {
|
||||
return to_zval_object(enc, data);
|
||||
} else {
|
||||
return guess_zval_convert(enc, data);
|
||||
}
|
||||
}
|
||||
|
||||
xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
|
||||
{
|
||||
sdlTypePtr type;
|
||||
xmlNodePtr ret = NULL;
|
||||
|
||||
type = enc.sdl_type;
|
||||
|
||||
if (type->restrictions) {
|
||||
if (type->restrictions->enumeration) {
|
||||
if (Z_TYPE_P(data) == IS_STRING) {
|
||||
if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) {
|
||||
php_error(E_WARNING,"Restriction: invalid enumeration value \"%s\".",Z_STRVAL_P(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type->encode) {
|
||||
if (type->encode->details.type == IS_ARRAY ||
|
||||
type->encode->details.type == SOAP_ENC_ARRAY) {
|
||||
ret = sdl_to_xml_array(type, data, style);
|
||||
} else if (type->encode->details.type == IS_OBJECT ||
|
||||
type->encode->details.type == SOAP_ENC_OBJECT) {
|
||||
ret = sdl_to_xml_object(type, data, style);
|
||||
} else {
|
||||
if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
|
||||
ret = master_to_xml(type->encode, data, style);
|
||||
} else {
|
||||
TSRMLS_FETCH();
|
||||
ret = master_to_xml(get_conversion(UNKNOWN_TYPE), data, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type->elements) {
|
||||
ret = sdl_to_xml_object(type, data, style);
|
||||
} else {
|
||||
ret = guess_xml_convert(enc, data, style);
|
||||
}
|
||||
set_ns_and_type(ret, enc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style)
|
||||
static xmlNodePtr sdl_to_xml_object(encodeType enc_type, zval *data, int style)
|
||||
{
|
||||
sdlTypePtr type = enc_type.sdl_type;
|
||||
xmlNodePtr ret;
|
||||
sdlTypePtr *t, tmp;
|
||||
TSRMLS_FETCH();
|
||||
|
@ -206,6 +151,9 @@ xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style)
|
|||
}
|
||||
zend_hash_move_forward(type->elements);
|
||||
}
|
||||
if (style == SOAP_ENCODED) {
|
||||
set_ns_and_type(ret, enc_type);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -244,8 +192,9 @@ static void add_xml_array_elements(xmlNodePtr xmlParam,
|
|||
}
|
||||
}
|
||||
|
||||
xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style)
|
||||
static xmlNodePtr sdl_to_xml_array(encodeType enc_type, zval *data, int style)
|
||||
{
|
||||
sdlTypePtr type = enc_type.sdl_type;
|
||||
smart_str array_type_and_size = {0}, array_type = {0};
|
||||
int i;
|
||||
int dimension = 1;
|
||||
|
@ -398,26 +347,80 @@ xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style)
|
|||
|
||||
add_xml_array_elements(xmlParam, type, enc, dimension, dims, data, style);
|
||||
efree(dims);
|
||||
if (style == SOAP_ENCODED) {
|
||||
set_ns_and_type(xmlParam, enc_type);
|
||||
}
|
||||
}
|
||||
|
||||
return xmlParam;
|
||||
}
|
||||
|
||||
sdlPtr get_sdl(char *uri)
|
||||
zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data)
|
||||
{
|
||||
sdlPtr tmp, *hndl;
|
||||
TSRMLS_FETCH();
|
||||
sdlTypePtr type;
|
||||
|
||||
tmp = NULL;
|
||||
hndl = NULL;
|
||||
if (zend_hash_find(SOAP_GLOBAL(sdls), uri, strlen(uri), (void **)&hndl) == FAILURE) {
|
||||
tmp = load_wsdl(uri);
|
||||
zend_hash_add(SOAP_GLOBAL(sdls), uri, strlen(uri), &tmp, sizeof(sdlPtr), NULL);
|
||||
} else {
|
||||
tmp = *hndl;
|
||||
type = enc.sdl_type;
|
||||
if (type->encode) {
|
||||
if (type->encode->details.type == IS_ARRAY ||
|
||||
type->encode->details.type == SOAP_ENC_ARRAY) {
|
||||
return to_zval_array(enc, data);
|
||||
} else if (type->encode->details.type == IS_OBJECT ||
|
||||
type->encode->details.type == SOAP_ENC_OBJECT) {
|
||||
return to_zval_object(enc, data);
|
||||
} else {
|
||||
if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
|
||||
return master_to_zval(type->encode, data);
|
||||
} else {
|
||||
TSRMLS_FETCH();
|
||||
return master_to_zval(get_conversion(UNKNOWN_TYPE), data);
|
||||
}
|
||||
}
|
||||
} else if (type->elements) {
|
||||
return to_zval_object(enc, data);
|
||||
} else {
|
||||
return guess_zval_convert(enc, data);
|
||||
}
|
||||
}
|
||||
|
||||
xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
|
||||
{
|
||||
sdlTypePtr type;
|
||||
xmlNodePtr ret = NULL;
|
||||
|
||||
type = enc.sdl_type;
|
||||
|
||||
if (type->restrictions) {
|
||||
if (type->restrictions->enumeration) {
|
||||
if (Z_TYPE_P(data) == IS_STRING) {
|
||||
if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) {
|
||||
php_error(E_WARNING,"Restriction: invalid enumeration value \"%s\".",Z_STRVAL_P(data));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return tmp;
|
||||
if (type->encode) {
|
||||
if (type->encode->details.type == IS_ARRAY ||
|
||||
type->encode->details.type == SOAP_ENC_ARRAY) {
|
||||
ret = sdl_to_xml_array(enc, data, style);
|
||||
} else if (type->encode->details.type == IS_OBJECT ||
|
||||
type->encode->details.type == SOAP_ENC_OBJECT) {
|
||||
ret = sdl_to_xml_object(enc, data, style);
|
||||
} else {
|
||||
if (memcmp(&type->encode->details,&enc,sizeof(enc))!=0) {
|
||||
ret = master_to_xml(type->encode, data, style);
|
||||
} else {
|
||||
TSRMLS_FETCH();
|
||||
ret = master_to_xml(get_conversion(UNKNOWN_TYPE), data, style);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type->elements) {
|
||||
ret = sdl_to_xml_object(enc, data, style);
|
||||
} else {
|
||||
ret = guess_xml_convert(enc, data, style);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type)
|
||||
|
@ -454,165 +457,6 @@ sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns)
|
|||
return binding;
|
||||
}
|
||||
|
||||
int load_php_sdl()
|
||||
{
|
||||
#ifdef BRAD_0
|
||||
xmlNodePtr rootElement;
|
||||
xmlNodePtr services;
|
||||
|
||||
SOAP_SERVER_GLOBAL_VARS();
|
||||
SOAP_SERVER_GLOBAL(availableServices) = xmlParseFile(servicesFile);
|
||||
rootElement = SOAP_SERVER_GLOBAL(availableServices)->children;
|
||||
services = rootElement->children;
|
||||
|
||||
do {
|
||||
if (IS_ELEMENT_TYPE(services,PHP_SOAPSERVER_SERVICE)) {
|
||||
phpSoapServicePtr newService;
|
||||
xmlNodePtr attrib, trav;
|
||||
HashTable *fn = NULL;
|
||||
HashTable *include = NULL;
|
||||
HashTable *cl = NULL;
|
||||
|
||||
/* Init New Service */
|
||||
newService = emalloc(sizeof(phpSoapService));
|
||||
newService->serviceNode = services;
|
||||
newService->started = FALSE;
|
||||
|
||||
fn = newService->functions = emalloc(sizeof(HashTable));
|
||||
include = newService->include_files = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(fn, 0, NULL, free_function, 0);
|
||||
zend_hash_init(include, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
attrib = services->properties;
|
||||
trav = attrib;
|
||||
/* Get Attributes of Service */
|
||||
do {
|
||||
if (IS_ATTRIBUTE_TYPE(trav,PHP_SOAPSERVER_SERVICE_NAME)) {
|
||||
char* name = ATTRIBUTE_VALUE(trav);
|
||||
|
||||
/* Assign Service Vals */
|
||||
ALLOC_INIT_ZVAL(newService->serviceName);
|
||||
ZVAL_STRING(newService->serviceName,name,1);
|
||||
}
|
||||
|
||||
if (IS_ATTRIBUTE_TYPE(trav,PHP_SOAPSERVER_SERVICE_STARTED)) {
|
||||
char* started = ATTRIBUTE_VALUE(trav);
|
||||
|
||||
/* Assign Service Vals */
|
||||
if (!stricmp(started,"true")) {
|
||||
newService->started = TRUE;
|
||||
}
|
||||
}
|
||||
} while (trav = trav->next);
|
||||
|
||||
/* Get ChildNodes of Service */
|
||||
trav = services->children;
|
||||
do {
|
||||
/* Include Files */
|
||||
if (IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_INCLUDE_FILE)) {
|
||||
xmlNodePtr trav1 = trav->properties;
|
||||
do {
|
||||
if (IS_ATTRIBUTE_TYPE(trav1,PHP_SOAPSERVER_SERVICE_INCLUDE_FILE_NAME)) {
|
||||
char* name = ATTRIBUTE_VALUE(trav1);
|
||||
zval* z_name;
|
||||
|
||||
ALLOC_INIT_ZVAL(z_name);
|
||||
ZVAL_STRING(z_name,name,1);
|
||||
zend_hash_next_index_insert(include,&z_name,sizeof(zval),NULL);
|
||||
}
|
||||
} while (trav1 = trav1->next);
|
||||
}
|
||||
|
||||
/* Functions */
|
||||
if (IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_FUNCTION)) {
|
||||
phpSoapServiceFunctionPtr function;
|
||||
xmlNodePtr trav1;
|
||||
HashTable *par = NULL;
|
||||
|
||||
function = emalloc(sizeof(phpSoapServiceFunction));
|
||||
function->functionNode = trav;
|
||||
|
||||
par = function->functionParams = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(par, 0, NULL, free_param, 0);
|
||||
|
||||
trav1 = trav->properties;
|
||||
|
||||
do {
|
||||
if (IS_ATTRIBUTE_TYPE(trav1,PHP_SOAPSERVER_SERVICE_FUNCTION_NAME)) {
|
||||
char* name = ATTRIBUTE_VALUE(trav1);
|
||||
|
||||
ALLOC_INIT_ZVAL(function->functionName);
|
||||
ZVAL_STRING(function->functionName,name,1);
|
||||
}
|
||||
} while (trav1 = trav1->next);
|
||||
|
||||
trav1 = trav->children;
|
||||
do {
|
||||
if (IS_ELEMENT_TYPE(trav1,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM)) {
|
||||
phpSoapServiceParamPtr param;
|
||||
xmlNodePtr trav2;
|
||||
|
||||
param = emalloc(sizeof(phpSoapServiceParam));
|
||||
param->paramNode = trav1;
|
||||
|
||||
trav2 = trav1->properties;
|
||||
|
||||
do {
|
||||
if (IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_NAME)) {
|
||||
char* name = ATTRIBUTE_VALUE(trav2);
|
||||
|
||||
ALLOC_INIT_ZVAL(param->paramName);
|
||||
ZVAL_STRING(param->paramName,name,1);
|
||||
} else if (IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_TYPE)) {
|
||||
char* type = ATTRIBUTE_VALUE(trav2);
|
||||
ALLOC_INIT_ZVAL(param->paramType);
|
||||
ZVAL_STRING(param->paramType,type,1);
|
||||
} else if (IS_ATTRIBUTE_TYPE(trav2,PHP_SOAPSERVER_SERVICE_FUNCTION_PARAM_POSITION)) {
|
||||
char* val = ATTRIBUTE_VALUE(trav2);
|
||||
ALLOC_INIT_ZVAL(param->paramName);
|
||||
ZVAL_LONG(param->paramName,atoi(val));
|
||||
}
|
||||
} while (trav2 = trav2->next);
|
||||
zend_hash_add(par,Z_STRVAL_P(param->paramName),Z_STRLEN_P(param->paramName),param,sizeof(phpSoapServiceParam),NULL);
|
||||
}
|
||||
} while (trav1 = trav1->next);
|
||||
zend_hash_add(fn,Z_STRVAL_P(function->functionName),Z_STRLEN_P(function->functionName),function,sizeof(phpSoapServiceFunction),NULL);
|
||||
}
|
||||
|
||||
/* Classes */
|
||||
if (IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_CLASS)) {
|
||||
xmlNodePtr att, func;
|
||||
att = trav->properties;
|
||||
|
||||
if (fn == NULL) {
|
||||
fn = newService->functions = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(fn, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} while (trav = trav->next);
|
||||
|
||||
zend_hash_add(SOAP_SERVER_GLOBAL(services),Z_STRVAL_P(newService->serviceName),Z_STRLEN_P(newService->serviceName),newService,sizeof(phpSoapService),NULL);
|
||||
}
|
||||
} while (services = services->next);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int write_php_sdl()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
typedef struct sdlCtx {
|
||||
sdlPtr root;
|
||||
HashTable messages;
|
||||
HashTable bindings;
|
||||
HashTable portTypes;
|
||||
HashTable services;
|
||||
} sdlCtx;
|
||||
|
||||
static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
||||
{
|
||||
sdlPtr tmpsdl = ctx->root;
|
||||
|
@ -651,9 +495,11 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
|||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't find \"definitions\" in %s", struri);
|
||||
}
|
||||
|
||||
targetNamespace = get_attribute(definitions->properties, "targetNamespace");
|
||||
if (targetNamespace) {
|
||||
tmpsdl->target_ns = strdup(targetNamespace->children->content);
|
||||
if (!include) {
|
||||
targetNamespace = get_attribute(definitions->properties, "targetNamespace");
|
||||
if (targetNamespace) {
|
||||
tmpsdl->target_ns = strdup(targetNamespace->children->content);
|
||||
}
|
||||
}
|
||||
|
||||
trav = definitions->children;
|
||||
|
@ -719,13 +565,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
|
|||
}
|
||||
}
|
||||
|
||||
static void delete_document(void *doc_ptr)
|
||||
{
|
||||
xmlDocPtr doc = *((xmlDocPtr*)doc_ptr);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
|
||||
sdlPtr load_wsdl(char *struri)
|
||||
static sdlPtr load_wsdl(char *struri)
|
||||
{
|
||||
sdlCtx ctx;
|
||||
int i,n;
|
||||
|
@ -734,6 +574,7 @@ sdlPtr load_wsdl(char *struri)
|
|||
memset(ctx.root, 0, sizeof(sdl));
|
||||
ctx.root->source = strdup(struri);
|
||||
zend_hash_init(&ctx.root->docs, 0, NULL, delete_document, 1);
|
||||
zend_hash_init(&ctx.root->functions, 0, NULL, delete_function, 1);
|
||||
|
||||
zend_hash_init(&ctx.messages, 0, NULL, NULL, 0);
|
||||
zend_hash_init(&ctx.bindings, 0, NULL, NULL, 0);
|
||||
|
@ -879,7 +720,6 @@ sdlPtr load_wsdl(char *struri)
|
|||
function->responseName = NULL;
|
||||
function->requestName = NULL;
|
||||
function->bindingAttributes = NULL;
|
||||
function->bindingType = tmpbinding->bindingType;
|
||||
|
||||
if (tmpbinding->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingFunctionPtr soapFunctionBinding;
|
||||
|
@ -1094,12 +934,8 @@ sdlPtr load_wsdl(char *struri)
|
|||
if (!fault) {
|
||||
}
|
||||
|
||||
if (!tmpbinding->functions) {
|
||||
tmpbinding->functions = malloc(sizeof(HashTable));
|
||||
zend_hash_init(tmpbinding->functions, 0, NULL, delete_function, 1);
|
||||
}
|
||||
|
||||
zend_hash_add(tmpbinding->functions, php_strtolower(function->functionName, strlen(function->functionName)), strlen(function->functionName), &function, sizeof(sdlFunctionPtr), NULL);
|
||||
function->binding = tmpbinding;
|
||||
zend_hash_add(&ctx.root->functions, php_strtolower(function->functionName, strlen(function->functionName)), strlen(function->functionName), &function, sizeof(sdlFunctionPtr), NULL);
|
||||
}
|
||||
ENDFOREACH(trav2);
|
||||
|
||||
|
@ -1126,142 +962,156 @@ sdlPtr load_wsdl(char *struri)
|
|||
return ctx.root;
|
||||
}
|
||||
|
||||
int write_wsdl()
|
||||
sdlPtr get_sdl(char *uri)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
sdlPtr tmp, *hndl;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
int write_ms_sdl()
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int load_ms_sdl(char *struri,int force_load)
|
||||
{
|
||||
/* Commenting this out. Does anyone need it? */
|
||||
#ifdef BRAD_0
|
||||
|
||||
if (get_sdl(struri) == NULL || force_load) {
|
||||
SOAP_TLS_VARS();
|
||||
xmlDocPtr sdl = xmlParseFile(struri);
|
||||
xmlNodePtr schema,trav,trav2,req,res,paramOrd,reqRes,address,serviceAdd,service,soap,serviceDesc,root = sdl->children;
|
||||
xmlAttrPtr tmpattr,uri;
|
||||
char *add,*functionName,*soapAction,*request,*response,*parameterOrder,*value,*namespace;
|
||||
SDLPtr sdlPtr;
|
||||
SoapFunctionPtr tmpFunction;
|
||||
zval *tempZval;
|
||||
serviceDesc = get_node(root,"serviceDescription");
|
||||
soap = get_node(serviceDesc->children,"soap");
|
||||
trav = soap->children;
|
||||
sdlPtr = emalloc(sizeof(SDL));
|
||||
|
||||
ALLOC_INIT_ZVAL(sdlPtr->sdlUri);
|
||||
ZVAL_STRING(sdlPtr->sdlUri,struri,1);
|
||||
|
||||
FOREACHNODE(trav,"service",service) {
|
||||
sdlPtr->soapFunctions = emalloc(sizeof(HashTable));
|
||||
sdlPtr->addresses = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(sdlPtr->soapFunctions, 0, NULL, delete_function, 0);
|
||||
zend_hash_init(sdlPtr->addresses, 0, NULL, ZVAL_PTR_DTOR, 0);
|
||||
|
||||
serviceAdd = get_node(service->children,"addresses");
|
||||
trav2 = serviceAdd->children;
|
||||
ALLOC_INIT_ZVAL(tempZval);
|
||||
FOREACHNODE(trav2,"address",address) {
|
||||
uri = get_attribute(address->properties,"uri");
|
||||
add = uri->children->content;
|
||||
ZVAL_STRING(tempZval,add,1);
|
||||
zend_hash_next_index_insert(sdlPtr->addresses,tempZval,sizeof(zval),NULL);
|
||||
}
|
||||
ENDFOREACH(trav2);
|
||||
trav2 = service->children;
|
||||
FOREACHNODE(trav2,"requestResponse",reqRes) {
|
||||
tmpFunction = emalloc(sizeof(SoapFunction));
|
||||
|
||||
tmpattr = get_attribute(reqRes->properties,"name");
|
||||
functionName = tmpattr->children->content;
|
||||
ALLOC_INIT_ZVAL(tmpFunction->functionName);
|
||||
ZVAL_STRING(tmpFunction->functionName,functionName,1);
|
||||
|
||||
tmpattr = get_attribute(reqRes->properties,"soapAction");
|
||||
soapAction = tmpattr->children->content;
|
||||
ALLOC_INIT_ZVAL(tmpFunction->soapAction);
|
||||
ZVAL_STRING(tmpFunction->soapAction,soapAction,1);
|
||||
|
||||
/* Request */
|
||||
req = get_node(reqRes->children,"request");
|
||||
tmpattr = get_attribute(req->properties,"ref");
|
||||
if (tmpattr != NULL) {
|
||||
request = tmpattr->children->content;
|
||||
parse_namespace(request,&value,&namespace);
|
||||
ALLOC_INIT_ZVAL(tmpFunction->requestName);
|
||||
ZVAL_STRING(tmpFunction->requestName,value,1);
|
||||
tmpFunction->requestParameters = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(tmpFunction->requestParameters, 0, NULL, delete_paramater, 0);
|
||||
efree(value);
|
||||
efree(namespace);
|
||||
}
|
||||
|
||||
/* Response */
|
||||
res = get_node(reqRes->children,"response");
|
||||
tmpattr = get_attribute(res->properties,"ref");
|
||||
if (tmpattr != NULL) {
|
||||
response = tmpattr->children->content;
|
||||
parse_namespace(response,&value,&namespace);
|
||||
ALLOC_INIT_ZVAL(tmpFunction->responseName);
|
||||
ZVAL_STRING(tmpFunction->responseName,value,1);
|
||||
tmpFunction->responseParameters = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(tmpFunction->responseParameters, 0, NULL, delete_paramater, 0);
|
||||
efree(value);
|
||||
efree(namespace);
|
||||
}
|
||||
|
||||
/* Parameters */
|
||||
paramOrd = get_node(reqRes->children,"parameterorder");
|
||||
if (paramOrd != NULL) {
|
||||
zval *space,*array,**strval;
|
||||
int count,i;
|
||||
ALLOC_INIT_ZVAL(space);
|
||||
ZVAL_STRING(space," ",0);
|
||||
parameterOrder = paramOrd->children->content;
|
||||
ZVAL_STRING(tempZval,parameterOrder,1);
|
||||
ALLOC_INIT_ZVAL(array);
|
||||
array_init(array);
|
||||
|
||||
/* Split on space */
|
||||
php_explode(space, tempZval, array, -1);
|
||||
zend_hash_internal_pointer_reset(array->value.ht);
|
||||
count = zend_hash_num_elements(array->value.ht);
|
||||
|
||||
for (i = 0;i < count;i++) {
|
||||
SoapParamPtr param;
|
||||
param = emalloc(sizeof(SoapParam));
|
||||
param->order = i+1;
|
||||
param->type = NULL;
|
||||
zend_hash_get_current_data(array->value.ht,(void **)&strval);
|
||||
ALLOC_INIT_ZVAL(param->paramName);
|
||||
ZVAL_STRING(param->paramName,Z_STRVAL_PP(strval),1);
|
||||
zend_hash_next_index_insert(tmpFunction->requestParameters,param,sizeof(SoapParam),NULL);
|
||||
zend_hash_move_forward(array->value.ht);
|
||||
}
|
||||
}
|
||||
zend_hash_add(sdlPtr->soapFunctions,(char *)php_strtolower(functionName,strlen(functionName)),strlen(functionName),tmpFunction,sizeof(SoapFunction),NULL);
|
||||
}
|
||||
ENDFOREACH(trav2);
|
||||
}
|
||||
ENDFOREACH(trav);
|
||||
|
||||
trav = serviceDesc->children;
|
||||
FOREACHNODE(trav,"schema",schema) {
|
||||
load_schema(&sdlPtr, schema);
|
||||
}
|
||||
ENDFOREACH(trav);
|
||||
sdlPtr->have_sdl = 1;
|
||||
map_types_to_functions(sdlPtr);
|
||||
zend_hash_add(SOAP_GLOBAL(SDLs),struri,strlen(struri),sdlPtr,sizeof(SDL),NULL);
|
||||
tmp = NULL;
|
||||
hndl = NULL;
|
||||
if (zend_hash_find(SOAP_GLOBAL(sdls), uri, strlen(uri), (void **)&hndl) == FAILURE) {
|
||||
tmp = load_wsdl(uri);
|
||||
zend_hash_add(SOAP_GLOBAL(sdls), uri, strlen(uri), &tmp, sizeof(sdlPtr), NULL);
|
||||
} else {
|
||||
tmp = *hndl;
|
||||
}
|
||||
#endif
|
||||
return FALSE;
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
/* Deletes */
|
||||
void delete_sdl(void *handle)
|
||||
{
|
||||
sdlPtr tmp = *((sdlPtr*)handle);
|
||||
|
||||
zend_hash_destroy(&tmp->docs);
|
||||
zend_hash_destroy(&tmp->functions);
|
||||
if (tmp->source) {
|
||||
free(tmp->source);
|
||||
}
|
||||
if (tmp->target_ns) {
|
||||
free(tmp->target_ns);
|
||||
}
|
||||
if (tmp->encoders) {
|
||||
zend_hash_destroy(tmp->encoders);
|
||||
free(tmp->encoders);
|
||||
}
|
||||
if (tmp->types) {
|
||||
zend_hash_destroy(tmp->types);
|
||||
free(tmp->types);
|
||||
}
|
||||
if (tmp->bindings) {
|
||||
zend_hash_destroy(tmp->bindings);
|
||||
free(tmp->bindings);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
static void delete_binding(void *data)
|
||||
{
|
||||
sdlBindingPtr binding = *((sdlBindingPtr*)data);
|
||||
|
||||
if (binding->location) {
|
||||
free(binding->location);
|
||||
}
|
||||
if (binding->name) {
|
||||
free(binding->name);
|
||||
}
|
||||
|
||||
if (binding->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingPtr soapBind = binding->bindingAttributes;
|
||||
free(soapBind->transport);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body)
|
||||
{
|
||||
if (body.ns) {
|
||||
free(body.ns);
|
||||
}
|
||||
if (body.parts) {
|
||||
free(body.parts);
|
||||
}
|
||||
if (body.encodingStyle) {
|
||||
free(body.encodingStyle);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_function(void *data)
|
||||
{
|
||||
sdlFunctionPtr function = *((sdlFunctionPtr*)data);
|
||||
|
||||
if (function->functionName) {
|
||||
free(function->functionName);
|
||||
}
|
||||
if (function->requestName) {
|
||||
free(function->requestName);
|
||||
}
|
||||
if (function->responseName) {
|
||||
free(function->responseName);
|
||||
}
|
||||
if (function->requestParameters) {
|
||||
zend_hash_destroy(function->requestParameters);
|
||||
free(function->requestParameters);
|
||||
}
|
||||
if (function->responseParameters) {
|
||||
zend_hash_destroy(function->responseParameters);
|
||||
free(function->responseParameters);
|
||||
}
|
||||
|
||||
if (function->bindingAttributes &&
|
||||
function->binding && function->binding->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingFunctionPtr soapFunction = function->bindingAttributes;
|
||||
if (soapFunction->soapAction) {
|
||||
free(soapFunction->soapAction);
|
||||
}
|
||||
delete_sdl_soap_binding_function_body(soapFunction->input);
|
||||
delete_sdl_soap_binding_function_body(soapFunction->output);
|
||||
delete_sdl_soap_binding_function_body(soapFunction->falut);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_paramater(void *data)
|
||||
{
|
||||
sdlParamPtr param = *((sdlParamPtr*)data);
|
||||
if (param->paramName) {
|
||||
free(param->paramName);
|
||||
}
|
||||
free(param);
|
||||
}
|
||||
|
||||
void delete_mapping(void *data)
|
||||
{
|
||||
soapMappingPtr map = (soapMappingPtr)data;
|
||||
|
||||
if (map->ns) {
|
||||
efree(map->ns);
|
||||
}
|
||||
if (map->ctype) {
|
||||
efree(map->ctype);
|
||||
}
|
||||
|
||||
if (map->type == SOAP_MAP_FUNCTION) {
|
||||
if (map->map_functions.to_xml_before) {
|
||||
zval_ptr_dtor(&map->map_functions.to_xml_before);
|
||||
}
|
||||
if (map->map_functions.to_xml) {
|
||||
zval_ptr_dtor(&map->map_functions.to_xml);
|
||||
}
|
||||
if (map->map_functions.to_xml_after) {
|
||||
zval_ptr_dtor(&map->map_functions.to_xml_after);
|
||||
}
|
||||
if (map->map_functions.to_zval_before) {
|
||||
zval_ptr_dtor(&map->map_functions.to_zval_before);
|
||||
}
|
||||
if (map->map_functions.to_zval) {
|
||||
zval_ptr_dtor(&map->map_functions.to_zval);
|
||||
}
|
||||
if (map->map_functions.to_zval_after) {
|
||||
zval_ptr_dtor(&map->map_functions.to_zval_after);
|
||||
}
|
||||
}
|
||||
efree(map);
|
||||
}
|
||||
|
||||
void delete_type(void *data)
|
||||
|
@ -1335,3 +1185,10 @@ void delete_attribute(void *attribute)
|
|||
free(attr->extraAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
static void delete_document(void *doc_ptr)
|
||||
{
|
||||
xmlDocPtr doc = *((xmlDocPtr*)doc_ptr);
|
||||
xmlFreeDoc(doc);
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
struct _sdl {
|
||||
HashTable docs; /* pointer to the parsed xml file */
|
||||
HashTable functions; /* array of sdlFunction */
|
||||
HashTable *types; /* array of sdlTypesPtr */
|
||||
HashTable *encoders; /* array of encodePtr */
|
||||
HashTable *bindings; /* array of sdlBindings (key'd by name) */
|
||||
|
@ -25,10 +26,9 @@ struct _sdl {
|
|||
|
||||
struct _sdlBinding {
|
||||
char *name;
|
||||
HashTable *functions;
|
||||
char *location;
|
||||
int bindingType;
|
||||
void *bindingAttributes;
|
||||
void *bindingAttributes; /* sdlSoapBindingPtr */
|
||||
};
|
||||
|
||||
/* Soap Binding Specfic stuff */
|
||||
|
@ -112,8 +112,9 @@ struct _sdlFunction {
|
|||
char *responseName;
|
||||
HashTable *requestParameters; /* array of sdlParamPtr */
|
||||
HashTable *responseParameters; /* array of sdlParamPtr (this should only be one) */
|
||||
int bindingType;
|
||||
void *bindingAttributes;
|
||||
struct _sdlBinding* binding;
|
||||
// int bindingType;
|
||||
void* bindingAttributes; /* sdlSoapBindingFunctionPtr */
|
||||
};
|
||||
|
||||
struct _sdlAttribute {
|
||||
|
@ -129,9 +130,6 @@ struct _sdlAttribute {
|
|||
};
|
||||
|
||||
sdlPtr get_sdl(char *uri);
|
||||
sdlPtr load_wsdl(char *struri);
|
||||
int load_sdl(char *struri, int force_load);
|
||||
int load_ms_sdl(char *struri, int force_load);
|
||||
|
||||
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const char *type);
|
||||
encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type);
|
||||
|
@ -145,9 +143,8 @@ sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
|
|||
xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval* data, int style);
|
||||
zval *sdl_guess_convert_zval(encodeType enc, xmlNodePtr data);
|
||||
|
||||
xmlNodePtr sdl_to_xml_array(sdlTypePtr type, zval *data, int style);
|
||||
xmlNodePtr sdl_to_xml_object(sdlTypePtr type, zval *data, int style);
|
||||
|
||||
void delete_sdl(void *handle);
|
||||
void delete_type(void *type);
|
||||
void delete_attribute(void *attribute);
|
||||
void delete_mapping(void *data);
|
||||
#endif
|
||||
|
|
|
@ -57,7 +57,6 @@ extern int le_http_socket;
|
|||
extern int le_url;
|
||||
extern int le_service;
|
||||
|
||||
|
||||
struct _soapHeaderHandler {
|
||||
char *ns;
|
||||
int type;
|
||||
|
@ -176,17 +175,11 @@ void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault
|
|||
zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
|
||||
|
||||
sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
|
||||
sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name);
|
||||
sdlFunctionPtr get_function(sdlPtr sdl, char *function_name);
|
||||
|
||||
void delete_sdl(void *handle);
|
||||
void delete_binding(void *binding);
|
||||
void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body);
|
||||
void delete_function(void *function);
|
||||
void delete_paramater(void *paramater);
|
||||
void delete_service(void *service);
|
||||
void delete_http_socket(void *handle);
|
||||
void delete_url(void *handle);
|
||||
void delete_mapping(void *data);
|
||||
|
||||
#ifndef ZEND_ENGINE_2
|
||||
void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_reference *property_reference);
|
||||
|
@ -264,20 +257,6 @@ int my_call_user_function(HashTable *function_table, zval **object_pp, zval *fun
|
|||
if (ZEND_NUM_ARGS() != 1 || getParameters(ht, 3, &p, &p1, &p2) == FAILURE) \
|
||||
WRONG_PARAM_COUNT;
|
||||
|
||||
#define FETCH_THIS_PORT(ss) \
|
||||
{ \
|
||||
zval *__thisObj; zval *__port; sdlBindingPtr *__tmp; \
|
||||
GET_THIS_OBJECT(__thisObj) \
|
||||
if(FIND_PORT_PROPERTY(__thisObj, __port) == FAILURE) { \
|
||||
ss = NULL; \
|
||||
php_error(E_ERROR, "Error could find current port"); \
|
||||
} \
|
||||
__tmp = (sdlBindingPtr*)Z_LVAL_P(__port); \
|
||||
ss = *__tmp; \
|
||||
}
|
||||
|
||||
#define FIND_PORT_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "port", sizeof("port"), (void **)&tmp)
|
||||
|
||||
#define FETCH_THIS_SDL(ss) \
|
||||
{ \
|
||||
zval *__thisObj,**__tmp; \
|
||||
|
@ -306,20 +285,6 @@ int my_call_user_function(HashTable *function_table, zval **object_pp, zval *fun
|
|||
#define FIND_SERVICE_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "service", sizeof("service"), (void **)&tmp)
|
||||
#define FETCH_SERVICE_RES(ss,tmp) ss = (soapServicePtr) zend_fetch_resource(tmp TSRMLS_CC, -1, "service", NULL, 1, le_service)
|
||||
|
||||
#define FETCH_THIS_URL(ss) \
|
||||
{ \
|
||||
zval *__thisObj,**__tmp; \
|
||||
GET_THIS_OBJECT(__thisObj) \
|
||||
if(FIND_URL_PROPERTY(__thisObj,__tmp) != FAILURE) { \
|
||||
FETCH_URL_RES(ss,__tmp); \
|
||||
} else { \
|
||||
ss = NULL; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define FIND_URL_PROPERTY(ss,tmp) zend_hash_find(Z_OBJPROP_P(ss), "httpurl", sizeof("httpurl"), (void **)&tmp)
|
||||
#define FETCH_URL_RES(ss,tmp) ss = (php_url *) zend_fetch_resource(tmp TSRMLS_CC, -1, "httpurl", NULL, 1, le_url)
|
||||
|
||||
#define FETCH_THIS_SOCKET(ss) \
|
||||
{ \
|
||||
zval *__thisObj,**__tmp; \
|
||||
|
|
185
ext/soap/soap.c
185
ext/soap/soap.c
|
@ -1158,7 +1158,8 @@ PHP_METHOD(soapserver, handle)
|
|||
|
||||
if (call_status == SUCCESS) {
|
||||
sdlFunctionPtr function;
|
||||
function = get_function(get_binding_from_type(service->sdl, BINDING_SOAP), Z_STRVAL(function_name));
|
||||
/* TODO: make 'strict' (use the sdl defnintions) */
|
||||
function = get_function(service->sdl, Z_STRVAL(function_name));
|
||||
SOAP_GLOBAL(overrides) = service->mapping;
|
||||
doc_return = seralize_response_call(function, response_name, service->uri, &retval, soap_version TSRMLS_CC);
|
||||
SOAP_GLOBAL(overrides) = NULL;
|
||||
|
@ -1312,8 +1313,6 @@ PHP_METHOD(soapobject, soapobject)
|
|||
ret = zend_list_insert(sdl, le_sdl);
|
||||
|
||||
add_property_resource(thisObj, "sdl", ret);
|
||||
/* FIXME: this is extremely bad practice */
|
||||
add_property_resource(thisObj, "port", (long)get_binding_from_type(sdl, BINDING_SOAP));
|
||||
zend_list_addref(ret);
|
||||
}
|
||||
}
|
||||
|
@ -1409,21 +1408,17 @@ static void do_soap_call(zval* thisObj,
|
|||
zend_try {
|
||||
SOAP_GLOBAL(sdl) = sdl;
|
||||
if (sdl != NULL) {
|
||||
sdlBindingPtr binding;
|
||||
|
||||
zval* this_ptr = thisObj;
|
||||
FETCH_THIS_PORT(binding);
|
||||
|
||||
php_strtolower(function, function_len);
|
||||
fn = get_function(binding, function);
|
||||
fn = get_function(sdl, function);
|
||||
if (fn != NULL) {
|
||||
sdlBindingPtr binding = fn->binding;
|
||||
if (binding->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
|
||||
request = seralize_function_call(thisObj, fn, NULL, fnb->input.ns, real_args, arg_count, soap_version TSRMLS_CC);
|
||||
ret = send_http_soap_request(thisObj, request, fnb->soapAction TSRMLS_CC);
|
||||
ret = send_http_soap_request(thisObj, request, binding->location, fnb->soapAction TSRMLS_CC);
|
||||
} else {
|
||||
request = seralize_function_call(thisObj, fn, NULL, sdl->target_ns, real_args, arg_count, soap_version TSRMLS_CC);
|
||||
ret = send_http_soap_request(thisObj, request, NULL TSRMLS_CC);
|
||||
ret = send_http_soap_request(thisObj, request, binding->location, NULL TSRMLS_CC);
|
||||
}
|
||||
|
||||
xmlFreeDoc(request);
|
||||
|
@ -1445,15 +1440,17 @@ zend_try {
|
|||
smart_str_free(&error);
|
||||
}
|
||||
} else {
|
||||
zval **uri;
|
||||
zval **uri, **location;
|
||||
smart_str *action;
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(thisObj), "uri", sizeof("uri"), (void *)&uri) == FAILURE) {
|
||||
add_soap_fault(thisObj, "SOAP-ENV:Client", "Error finding uri in soap_call_function_handler", NULL, NULL TSRMLS_CC);
|
||||
add_soap_fault(thisObj, "SOAP-ENV:Client", "Error finding \"uri\" property", NULL, NULL TSRMLS_CC);
|
||||
} else if (zend_hash_find(Z_OBJPROP_P(thisObj), "location", sizeof("location"),(void **) &location) == FAILURE) {
|
||||
add_soap_fault(thisObj, "SOAP-ENV:Client", "Error could not find \"location\" property", NULL, NULL TSRMLS_CC);
|
||||
} else {
|
||||
request = seralize_function_call(thisObj, NULL, function, Z_STRVAL_PP(uri), real_args, arg_count, soap_version TSRMLS_CC);
|
||||
action = build_soap_action(thisObj, function);
|
||||
ret = send_http_soap_request(thisObj, request, action->c TSRMLS_CC);
|
||||
ret = send_http_soap_request(thisObj, request, Z_STRVAL_PP(location), action->c TSRMLS_CC);
|
||||
|
||||
smart_str_free(action);
|
||||
efree(action);
|
||||
|
@ -1596,17 +1593,14 @@ PHP_METHOD(soapobject, __getfunctions)
|
|||
if (sdl) {
|
||||
smart_str buf = {0};
|
||||
sdlFunctionPtr *function;
|
||||
sdlBindingPtr binding;
|
||||
|
||||
FETCH_THIS_PORT(binding);
|
||||
|
||||
array_init(return_value);
|
||||
zend_hash_internal_pointer_reset_ex(binding->functions, &pos);
|
||||
while (zend_hash_get_current_data_ex(binding->functions, (void **)&function, &pos) != FAILURE) {
|
||||
zend_hash_internal_pointer_reset_ex(&sdl->functions, &pos);
|
||||
while (zend_hash_get_current_data_ex(&sdl->functions, (void **)&function, &pos) != FAILURE) {
|
||||
function_to_string((*function), &buf);
|
||||
add_next_index_stringl(return_value, buf.c, buf.len, 1);
|
||||
zend_hash_move_forward_ex(binding->functions, &pos);
|
||||
smart_str_free(&buf);
|
||||
zend_hash_move_forward_ex(&sdl->functions, &pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1811,15 +1805,12 @@ void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name
|
|||
php_error(E_ERROR,"looks like we got \"Body\" without function call\n");
|
||||
}
|
||||
|
||||
/* TODO: make 'strict' (use the sdl defnintions) */
|
||||
binding = get_binding_from_type(sdl, BINDING_SOAP);
|
||||
|
||||
INIT_ZVAL(tmp_function_name);
|
||||
ZVAL_STRING(&tmp_function_name, (char *)func->name, 1);
|
||||
|
||||
(*function_name) = tmp_function_name;
|
||||
|
||||
function = get_function(binding, php_strtolower((char *)func->name, strlen(func->name)));
|
||||
function = get_function(sdl, php_strtolower((char *)func->name, strlen(func->name)));
|
||||
if (sdl != NULL && function == NULL) {
|
||||
php_error(E_ERROR, "Error function \"%s\" doesn't exists for this service \"%s\"", func->name, binding->location);
|
||||
}
|
||||
|
@ -2003,7 +1994,7 @@ xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *
|
|||
gen_ns = encode_new_ns();
|
||||
|
||||
if (function) {
|
||||
if (function->bindingType == BINDING_SOAP) {
|
||||
if (function->binding->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)function->bindingAttributes;
|
||||
|
||||
style = fnb->style;
|
||||
|
@ -2048,7 +2039,7 @@ xmlDocPtr seralize_function_call(zval *this_ptr, sdlFunctionPtr function, char *
|
|||
if (style == SOAP_RPC) {
|
||||
xmlAddChild(method, param);
|
||||
} else if (style == SOAP_DOCUMENT) {
|
||||
if (function && function->bindingType == BINDING_SOAP) {
|
||||
if (function && function->binding->bindingType == BINDING_SOAP) {
|
||||
sdlParamPtr *sparam;
|
||||
|
||||
if (zend_hash_index_find(function->requestParameters, 0, (void **)&sparam) == SUCCESS) {
|
||||
|
@ -2146,11 +2137,11 @@ sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int
|
|||
return NULL;
|
||||
}
|
||||
|
||||
sdlFunctionPtr get_function(sdlBindingPtr sdl, char *function_name)
|
||||
sdlFunctionPtr get_function(sdlPtr sdl, char *function_name)
|
||||
{
|
||||
sdlFunctionPtr *tmp;
|
||||
if (sdl != NULL) {
|
||||
if (zend_hash_find(sdl->functions, function_name, strlen(function_name), (void **)&tmp) != FAILURE) {
|
||||
if (zend_hash_find(&sdl->functions, function_name, strlen(function_name), (void **)&tmp) != FAILURE) {
|
||||
return (*tmp);
|
||||
}
|
||||
}
|
||||
|
@ -2234,33 +2225,6 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
|
|||
smart_str_0(buf);
|
||||
}
|
||||
|
||||
/* Deletes */
|
||||
void delete_sdl(void *handle)
|
||||
{
|
||||
sdlPtr tmp = *((sdlPtr*)handle);
|
||||
|
||||
zend_hash_destroy(&tmp->docs);
|
||||
if (tmp->source) {
|
||||
free(tmp->source);
|
||||
}
|
||||
if (tmp->target_ns) {
|
||||
free(tmp->target_ns);
|
||||
}
|
||||
if (tmp->encoders) {
|
||||
zend_hash_destroy(tmp->encoders);
|
||||
free(tmp->encoders);
|
||||
}
|
||||
if (tmp->types) {
|
||||
zend_hash_destroy(tmp->types);
|
||||
free(tmp->types);
|
||||
}
|
||||
if (tmp->bindings) {
|
||||
zend_hash_destroy(tmp->bindings);
|
||||
free(tmp->bindings);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void delete_url(void *handle)
|
||||
{
|
||||
php_url_free((php_url*)handle);
|
||||
|
@ -2291,114 +2255,3 @@ void delete_service(void *data)
|
|||
efree(service->uri);
|
||||
efree(service);
|
||||
}
|
||||
|
||||
void delete_binding(void *data)
|
||||
{
|
||||
sdlBindingPtr binding = *((sdlBindingPtr*)data);
|
||||
|
||||
if (binding->functions) {
|
||||
zend_hash_destroy(binding->functions);
|
||||
free(binding->functions);
|
||||
}
|
||||
|
||||
if (binding->location) {
|
||||
free(binding->location);
|
||||
}
|
||||
if (binding->name) {
|
||||
free(binding->name);
|
||||
}
|
||||
|
||||
if (binding->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingPtr soapBind = binding->bindingAttributes;
|
||||
free(soapBind->transport);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_function(void *data)
|
||||
{
|
||||
sdlFunctionPtr function = *((sdlFunctionPtr*)data);
|
||||
|
||||
if (function->functionName) {
|
||||
free(function->functionName);
|
||||
}
|
||||
if (function->requestName) {
|
||||
free(function->requestName);
|
||||
}
|
||||
if (function->responseName) {
|
||||
free(function->responseName);
|
||||
}
|
||||
if (function->requestParameters) {
|
||||
zend_hash_destroy(function->requestParameters);
|
||||
free(function->requestParameters);
|
||||
}
|
||||
if (function->responseParameters) {
|
||||
zend_hash_destroy(function->responseParameters);
|
||||
free(function->responseParameters);
|
||||
}
|
||||
|
||||
if (function->bindingType == BINDING_SOAP) {
|
||||
sdlSoapBindingFunctionPtr soapFunction = function->bindingAttributes;
|
||||
if (soapFunction->soapAction) {
|
||||
free(soapFunction->soapAction);
|
||||
}
|
||||
delete_sdl_soap_binding_function_body(soapFunction->input);
|
||||
delete_sdl_soap_binding_function_body(soapFunction->output);
|
||||
delete_sdl_soap_binding_function_body(soapFunction->falut);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body)
|
||||
{
|
||||
if (body.ns) {
|
||||
free(body.ns);
|
||||
}
|
||||
if (body.parts) {
|
||||
free(body.parts);
|
||||
}
|
||||
if (body.encodingStyle) {
|
||||
free(body.encodingStyle);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_paramater(void *data)
|
||||
{
|
||||
sdlParamPtr param = *((sdlParamPtr*)data);
|
||||
if (param->paramName) {
|
||||
free(param->paramName);
|
||||
}
|
||||
free(param);
|
||||
}
|
||||
|
||||
void delete_mapping(void *data)
|
||||
{
|
||||
soapMappingPtr map = (soapMappingPtr)data;
|
||||
|
||||
if (map->ns) {
|
||||
efree(map->ns);
|
||||
}
|
||||
if (map->ctype) {
|
||||
efree(map->ctype);
|
||||
}
|
||||
|
||||
if (map->type == SOAP_MAP_FUNCTION) {
|
||||
if (map->map_functions.to_xml_before) {
|
||||
zval_ptr_dtor(&map->map_functions.to_xml_before);
|
||||
}
|
||||
if (map->map_functions.to_xml) {
|
||||
zval_ptr_dtor(&map->map_functions.to_xml);
|
||||
}
|
||||
if (map->map_functions.to_xml_after) {
|
||||
zval_ptr_dtor(&map->map_functions.to_xml_after);
|
||||
}
|
||||
if (map->map_functions.to_zval_before) {
|
||||
zval_ptr_dtor(&map->map_functions.to_zval_before);
|
||||
}
|
||||
if (map->map_functions.to_zval) {
|
||||
zval_ptr_dtor(&map->map_functions.to_zval);
|
||||
}
|
||||
if (map->map_functions.to_zval_after) {
|
||||
zval_ptr_dtor(&map->map_functions.to_zval_after);
|
||||
}
|
||||
}
|
||||
efree(map);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue