3 changed files with 147 additions and 19 deletions
@ -0,0 +1,54 @@ |
|||
--TEST-- |
|||
SOAP Classmap 3: encoding of inherited objects |
|||
--SKIPIF-- |
|||
<?php require_once('skipif.inc'); ?> |
|||
--FILE-- |
|||
<?php |
|||
ini_set("soap.wsdl_cache_enabled",0); |
|||
|
|||
class A { |
|||
public $x; |
|||
function __construct($a){ |
|||
$this->x = $a; |
|||
} |
|||
} |
|||
|
|||
class B extends A { |
|||
public $y; |
|||
function __construct($a){ |
|||
parent::__construct($a); |
|||
$this->y = $a + 1; |
|||
} |
|||
} |
|||
|
|||
function f(){ |
|||
return new B(5); |
|||
} |
|||
|
|||
class LocalSoapClient extends SoapClient { |
|||
|
|||
function __construct($wsdl, $options) { |
|||
parent::__construct($wsdl, $options); |
|||
$this->server = new SoapServer($wsdl, $options); |
|||
$this->server->addFunction("f"); |
|||
} |
|||
|
|||
function __doRequest($request, $location, $action, $version) { |
|||
ob_start(); |
|||
$this->server->handle($request); |
|||
$response = ob_get_contents(); |
|||
ob_end_clean(); |
|||
return $response; |
|||
} |
|||
} |
|||
|
|||
$client = new LocalSoapClient(dirname(__FILE__)."/classmap003.wsdl", |
|||
array('classmap'=>array('A'=>'A','B'=>'B'))); |
|||
print_r($client->f()); |
|||
?> |
|||
--EXPECT-- |
|||
B Object |
|||
( |
|||
[x] => 5 |
|||
[y] => 6 |
|||
) |
|||
@ -0,0 +1,51 @@ |
|||
<?xml version='1.0' encoding='UTF-8'?> |
|||
|
|||
<!-- WSDL file generated by Zend Studio. --> |
|||
|
|||
<definitions name="ab" targetNamespace="urn:ab" xmlns:typens="urn:ab" 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:ab"> |
|||
<xsd:complexType name="A"> |
|||
<xsd:sequence> |
|||
<xsd:element name="x" type="xsd:anyType"/> |
|||
</xsd:sequence> |
|||
</xsd:complexType> |
|||
<xsd:complexType name="B"> |
|||
<xsd:complexContent> |
|||
<xsd:extension base="typens:A"> |
|||
<xsd:sequence> |
|||
<xsd:element name="y" type="xsd:anyType"/> |
|||
</xsd:sequence> |
|||
</xsd:extension> |
|||
</xsd:complexContent> |
|||
</xsd:complexType> |
|||
</xsd:schema> |
|||
</types> |
|||
<message name="f"/> |
|||
<message name="fResponse"> |
|||
<part name="fReturn" type="typens:A"/> |
|||
</message> |
|||
<portType name="abServerPortType"> |
|||
<operation name="f"> |
|||
<input message="typens:f"/> |
|||
<output message="typens:fResponse"/> |
|||
</operation> |
|||
</portType> |
|||
<binding name="abServerBinding" type="typens:abServerPortType"> |
|||
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> |
|||
<operation name="f"> |
|||
<soap:operation soapAction="urn:abServerAction"/> |
|||
<input> |
|||
<soap:body namespace="urn:ab" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> |
|||
</input> |
|||
<output> |
|||
<soap:body namespace="urn:ab" use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> |
|||
</output> |
|||
</operation> |
|||
</binding> |
|||
<service name="abService"> |
|||
<port name="abServerPort" binding="typens:abServerBinding"> |
|||
<soap:address location="http://localhost/abServer.php"/> |
|||
</port> |
|||
</service> |
|||
</definitions> |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue