|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-07-07 14:52 UTC] sl at yes-co dot nl
Description:
------------
Putting a value like this in a SOAP response:
new SoapParam("true", XSD_BOOLEAN)
results in:
<Foo xsi:type="xsd:boolean">0</Foo>
while it should be
<Foo xsi:type="xsd:boolean">true</Foo>
Reproduce code:
---------------
<?php
$server=new SoapServer(null, Array("uri" => "http://localhost/", "location" => "http://localhost/"));
$server->addFunction(Foo);
$server->handle('
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" >
<SOAP-ENV:Body>
<m:Foo>
</m:Foo>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
');
function Foo() {
return new SoapVar('true', XSD_BOOLEAN);
}
?>
Expected result:
----------------
<SOAP-ENV:Envelope ...>
<SOAP-ENV:Body>
<ns1:FooResponse>
<return xsi:type="xsd:boolean">true</return>
</ns1:FooResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Actual result:
--------------
<SOAP-ENV:Envelope ...>
<SOAP-ENV:Body>
<ns1:FooResponse>
<return xsi:type="xsd:boolean">0</return>
</ns1:FooResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 25 02:00:01 2025 UTC |
Confirmed for PHP Version 5.1.0-dev (Jul 21 2005 08:29:50). new SoapVar('true', XSD_BOOLEAN) should give: <return xsi:type="xsd:boolean">true</return> but gives: <return xsi:type="xsd:boolean">0</return>This works as expected: new SoapVar("2001-01-02T18:28:40+01:00", XSD_DATETIME) The first parameter is put between XML tags, although it is not a PHP type for a date. The string is just put between tags which indicate it is a datetime. Therefore, new SoapVar("true", XSD_BOOLEAN) should put "true" between tags which indicate that it is a boolean.