dmitry Mon Apr 10 13:29:57 2006 UTC
Modified files:
/php-src/ext/soap php_encoding.c
/php-src/ext/soap/tests/bugs bug36908.phpt bug36908.wsdl
Log:
Fixed bug #36908 (wsdl default value overrides value in soap request).
http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/php_encoding.c?r1=1.124&r2=1.125&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.124
php-src/ext/soap/php_encoding.c:1.125
--- php-src/ext/soap/php_encoding.c:1.124 Sun Apr 9 23:38:30 2006
+++ php-src/ext/soap/php_encoding.c Mon Apr 10 13:29:57 2006
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_encoding.c,v 1.124 2006/04/09 23:38:30 andrei Exp $ */
+/* $Id: php_encoding.c,v 1.125 2006/04/10 13:29:57 dmitry Exp $ */
#include <time.h>
@@ -1130,11 +1130,13 @@
{
switch (model->kind) {
case XSD_CONTENT_ELEMENT:
- if (model->u.element->name) {
- xmlNodePtr node = get_node(data->children,
model->u.element->name);
- if (node) {
- zval *val;
+ if (model->u.element->name) {
+ xmlNodePtr node = get_node(data->children,
model->u.element->name);
+ if (node) {
+ zval *val;
+
+ node = check_and_resolve_href(node);
if (node && node->children &&
node->children->content) {
if (model->u.element->fixed &&
strcmp(model->u.element->fixed,node->children->content) != 0) {
soap_error3(E_ERROR,
"Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)",
model->u.element->name, model->u.element->fixed, node->children->content);
http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/tests/bugs/bug36908.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug36908.phpt
diff -u /dev/null php-src/ext/soap/tests/bugs/bug36908.phpt:1.2
--- /dev/null Mon Apr 10 13:29:57 2006
+++ php-src/ext/soap/tests/bugs/bug36908.phpt Mon Apr 10 13:29:57 2006
@@ -0,0 +1,46 @@
+--TEST--
+Bug #36908 (wsdl default value overrides value in soap request)
+--SKIPIF--
+<?php
+ if (!extension_loaded('soap')) die('skip soap extension not available');
+?>
+--INI--
+soap.wsdl_cache_enabled=0
+--FILE--
+<?php
+class PublisherService {
+ function add($publisher) {
+ return $publisher->region_id;
+ }
+}
+$input =
+'<?xml version="1.0" encoding="UTF-8"?>
+<soapenv:Envelope
+xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <soapenv:Body>
+ <ns1:add xmlns:ns1="urn:PublisherService"
soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
+ <publisher href="#id0"/>
+ </ns1:add>
+ <multiRef xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:ns3="http://soap.dev/soap/types" id="id0" soapenc:root="0"
+soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+xsi:type="ns3:publisher">
+ <region_id href="#id5"/>
+ </multiRef>
+ <multiRef xmlns:ns5="http://soap.dev/soap/types"
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" id="id5"
+soapenc:root="0"
+soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+xsi:type="xsd:long">9</multiRef>
+ </soapenv:Body>
+</soapenv:Envelope>';
+ini_set('soap.wsdl_cache_enabled', false);
+$server = new SoapServer(dirname(__FILE__)."/bug36908.wsdl");
+$server->setClass("PublisherService");
+$server->handle($input);
+?>
+--EXPECT--
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:PublisherService" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:addResponse><out
xsi:type="xsd:string">9</out></ns1:addResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
http://cvs.php.net/viewcvs.cgi/php-src/ext/soap/tests/bugs/bug36908.wsdl?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug36908.wsdl
diff -u /dev/null php-src/ext/soap/tests/bugs/bug36908.wsdl:1.2
--- /dev/null Mon Apr 10 13:29:57 2006
+++ php-src/ext/soap/tests/bugs/bug36908.wsdl Mon Apr 10 13:29:57 2006
@@ -0,0 +1,51 @@
+<?xml version="1.0"?>
+<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+xmlns:api="http://soap.dev/soap/PublisherService"
+xmlns:types="http://soap.dev/soap/types"
+targetNamespace="http://soap.dev/soap/PublisherService">
+ <wsdl:types>
+ <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+xmlns:types="http://soap.dev/soap/types"
+targetNamespace="http://soap.dev/soap/types">
+ <xsd:complexType name="publisher">
+ <xsd:all>
+ <xsd:element name="region_id" type="xsd:long" default="52"/>
+ </xsd:all>
+ </xsd:complexType>
+ </xsd:schema>
+ </wsdl:types>
+ <wsdl:message name="addInput">
+ <wsdl:part name="publisher" type="types:publisher"/>
+ </wsdl:message>
+ <wsdl:message name="addOutput">
+ <wsdl:part name="out" type="xsd:string"/>
+ </wsdl:message>
+ <wsdl:portType name="PublisherServicePortType">
+ <wsdl:operation name="add">
+ <wsdl:input message="api:addInput"/>
+ <wsdl:output message="api:addOutput"/>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="PublisherServiceBinding"
type="api:PublisherServicePortType">
+ <soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="add">
+ <soap:operation soapAction="urn:PublisherService#add" style="rpc"/>
+ <wsdl:input>
+ <soap:body use="encoded" namespace="urn:PublisherService"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </wsdl:input>
+ <wsdl:output>
+ <soap:body use="encoded" namespace="urn:PublisherService"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
+ </wsdl:output>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="PublisherService">
+ <wsdl:port name="PublisherServicePort"
binding="api:PublisherServiceBinding">
+ <soap:address location="http://soap.dev/soap//publisher_test.php"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php