php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34643 wsdl default value
Submitted: 2005-09-26 13:28 UTC Modified: 2005-10-03 11:53 UTC
From: camka at email dot ee Assigned: dmitry (profile)
Status: Closed Package: SOAP related
PHP Version: 5CVS-2005-09-26 (snap) OS: linux
Private report: No CVE-ID: None
 [2005-09-26 13:28 UTC] camka at email dot ee
Description:
------------
I want to set default value for the parameter passed to the remote function in wsdl file. When working in non-wsdl mode, the default value on server side is initiated with no problems. But when using wsdl file for client/server initialization, the default value is processed strange way.



Reproduce code:
---------------
======= srv.php ==========

class fp
{
	public function get_it($opt = 'zzz')
	{
		return $opt;
	}
}

$srv = new SoapServer('wsdl.wsdl');
$srv->setClass('fp');
$srv->handle();

======= client.php ==========

...
$cl = new SoapClient('wsdl.wsdl', $options);
var_dump($cl->__getFunctions());
echo $cl->get_it();

======== wsdl.wsdl ==========
<?xml version='1.0' encoding='UTF-8'?>

<definitions name="wsdl" targetNamespace="urn:wsdl" xmlns:typens="urn:wsdl" 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="http://schemas.xmlsoap.org/wsdl/">
	<types>
		<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:wsdl">

			<xsd:element name="opt" default="zzz" />

		</xsd:schema>
	</types>
	<message name="get_it">
		<part name="opt" type="typens:opt"/>
	</message>
	<message name="get_itResponse">
		<part name="return" type="xsd:string"/>
	</message>
	<portType name="fpPortType">
		<operation name="get_it">
			<documentation>
				Enter description here...
			</documentation>
			<input message="typens:get_it"/>
			<output message="typens:get_itResponse"/>
		</operation>
	</portType>
	<binding name="fpBinding" type="typens:fpPortType">
		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
		<operation name="get_it">
			<soap:operation soapAction="urn:fpAction"/>
			<input>
				<soap:body namespace="urn:wsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
			</input>
			<output>
				<soap:body namespace="urn:wsdl" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
			</output>
		</operation>
	</binding>
	<service name="wsdlService">
		<port name="fpPort" binding="typens:fpBinding">
			<soap:address location="**********/>
		</port>
	</service>
</definitions>


======== SOAP request ==============
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:wsdl"
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:get_it>
<opt
xsi:nil="1"/>
</ns1:get_it>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

=========== SOAP Response =========
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:ns1="urn:wsdl"
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:get_itResponse>
<return xsi:nil="1"/>
</ns1:get_itResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


Expected result:
----------------
array(1) {
  [0]=>
  string(27) "string get_it(opt $opt)"
}

zzz


Actual result:
--------------
array(1) {
  [0]=>
  string(27) "string get_it(UNKNOWN $opt)"
}

NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-27 17:28 UTC] dmitry@php.net
The bug is fixed in CVS HEAD, PHP_5_1 and PHP_5_0.

The wsdl file in report has mistakes. The fixed file can be found in CVS: ext/soap/tests/bugs/bug34643.wsdl
 [2005-09-27 23:42 UTC] camka at email dot ee
if i call function with parameter=NULL explicitly

$cl->get_it(NULL);

the default value is returned as a result. should be NULL value.
 [2005-09-28 13:46 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-09-28 19:42 UTC] camka at email dot ee
problem exists with the latest snapshot.
 [2005-09-28 20:44 UTC] sniper@php.net
Dmitry, not fixed?

 [2005-10-03 11:53 UTC] dmitry@php.net
Fixed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC