diff options
| author | Dmitry Stogov <dmitry@php.net> | 2004-01-16 07:11:59 +0000 | 
|---|---|---|
| committer | Dmitry Stogov <dmitry@php.net> | 2004-01-16 07:11:59 +0000 | 
| commit | ad648d82e5acac9b22dde891c863b61a74a1a2b5 (patch) | |
| tree | 6c2d0cd2d0f06d370bc00497a89520ecc2be8f59 | |
| parent | 071565178549a718e9a19c6f659723b22a49cb8f (diff) | |
| download | php-git-ad648d82e5acac9b22dde891c863b61a74a1a2b5.tar.gz | |
SOAP 1.2: enc:id & enc:ref attributes support and fault codes (Sender/Receiver) where implemented
| -rw-r--r-- | ext/soap/TODO | 2 | ||||
| -rw-r--r-- | ext/soap/php_xml.c | 19 | ||||
| -rw-r--r-- | ext/soap/soap.c | 21 | 
3 files changed, 39 insertions, 3 deletions
diff --git a/ext/soap/TODO b/ext/soap/TODO index b4a744d97f..fcd61548d6 100644 --- a/ext/soap/TODO +++ b/ext/soap/TODO @@ -62,7 +62,7 @@ Encoding  	  SOAP 1.2 doesn't support partially transmitted and sparse arrays  - full support for structures???    + references (id,href) -- SOAP 1.2 (enc:id,enc:ref) ++ SOAP 1.2 (enc:id,enc:ref)  - references to external resources  - default values  - root attribute diff --git a/ext/soap/php_xml.c b/ext/soap/php_xml.c index ce560b6f35..5e55e467b6 100644 --- a/ext/soap/php_xml.c +++ b/ext/soap/php_xml.c @@ -162,7 +162,24 @@ xmlNodePtr check_and_resolve_href(xmlNodePtr data)  				if (!ret) {  					php_error(E_ERROR,"Unresolved reference '%s'",href->children->content);					  				} -				data = ret; +				return ret; +			} else { +				/*  TODO: External href....? */ +				php_error(E_ERROR,"External reference '%s'",href->children->content);					 +			} +		} +		/* SOAP 1.2 enc:id enc:ref */ +		href = get_attribute_ex(data->properties, "ref", SOAP_1_2_ENC_NAMESPACE); +		if (href) { +			/*  Internal href try and find node */ +			if (href->children->content[0] == '#') { +				xmlNodePtr ret = get_node_with_attribute_recursive_ex(data->doc->children, NULL, NULL, "id", &href->children->content[1], SOAP_1_2_ENC_NAMESPACE); +				if (!ret) { +					php_error(E_ERROR,"Unresolved reference '%s'",href->children->content);					 +				} else if (ret == data) { +					php_error(E_ERROR,"Violation of id and ref information items '%s'",href->children->content);					 +				} +				return ret;  			} else {  				/*  TODO: External href....? */  				php_error(E_ERROR,"External reference '%s'",href->children->content);					 diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 53afa15f4c..367ad69bce 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -1714,7 +1714,26 @@ static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char  		add_property_string(obj, "faultstring", fault_string, 1);  	}  	if (fault_code != NULL) { -		add_property_string(obj, "faultcode", fault_code, 1); +		int soap_version = SOAP_GLOBAL(soap_version); +		smart_str code = {0}; +		if (soap_version == SOAP_1_1) { +			smart_str_appendl(&code, SOAP_1_1_ENV_NS_PREFIX, sizeof(SOAP_1_1_ENV_NS_PREFIX)-1); +			smart_str_appendc(&code, ':'); +			smart_str_appends(&code,fault_code); +		} else if (soap_version == SOAP_1_2) { +			smart_str_appendl(&code, SOAP_1_2_ENV_NS_PREFIX, sizeof(SOAP_1_2_ENV_NS_PREFIX)-1); +			smart_str_appendc(&code, ':'); +			if (strcmp(fault_code,"Client") == 0) { +				smart_str_appendl(&code,"Sencer",sizeof("Sender")-1); +			} else if (strcmp(fault_code,"Server") == 0) { +				smart_str_appendl(&code,"Receiver",sizeof("Receiver")-1); +			} else { +				smart_str_appends(&code,fault_code); +			} +		} +		smart_str_0(&code); +		add_property_string(obj, "faultcode", code.c, 1); +		smart_str_free(&code);  	}  	if (fault_actor != NULL) {  		add_property_string(obj, "faultactor", fault_actor, 1);  | 
