3v4l.org

run code in 300+ PHP versions simultaneously
<?php $wsdl = <<<'WSDL' <?xml version='1.0' encoding='UTF-8'?> <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="Broken"> <xsd:sequence> <xsd:element name="completelyBroken" type="xsd:anyType"/> </xsd:sequence> </xsd:complexType> </xsd:schema> </types> <message name="f"> <part name="fRequest" type="typens:A"/> </message> <message name="fResponse"> <part name="fRequest" 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/dummy"/> </port> </service> </definitions> WSDL; file_put_contents('test.wsdl', $wsdl); function f($a) { return $a; } 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, $one_way = 0) { ob_start(); $this->server->handle($request); $response = ob_get_contents(); ob_end_clean(); return $response; } } class Broken { public $completelyBroken; } $client = new LocalSoapClient('test.wsdl', array('classmap' => array('Broken' => 'Broken')) ); $broken = new Broken(); $broken->completelyBroken = 'indeed it is'; print_r($client->f($broken));

preferences:
43.34 ms | 402 KiB | 5 Q