public function testGetLastResponse() { if (headers_sent()) { $this->markTestSkipped('Cannot run testGetLastResponse() when headers have already been sent; enable output buffering to run this test'); return; } $server = new Zend_Soap_Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl'); $server->setClass('Zend_Soap_Client_TestClass'); $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl'); // Perform request $client->testFunc2('World'); $expectedResponse = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" ' . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">' . '<env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">' . '<env:testFunc2Response env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">' . '<rpc:result>testFunc2Return</rpc:result>' . '<testFunc2Return xsi:type="xsd:string">Hello World!</testFunc2Return>' . '</env:testFunc2Response>' . '</env:Body>' . '</env:Envelope>' . "\n"; $this->assertEquals($client->getLastResponse(), $expectedResponse); }
public function testGetLastResponse() { if (!extension_loaded('soap')) { $this->markTestSkipped('SOAP Extension is not loaded'); } $server = new Zend_Soap_Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl'); $server->setClass('Zend_Soap_Client_TestClass'); $client = new Zend_Soap_Client_Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl'); // Perform request $client->testFunc2('World'); $expectedResponse = '<?xml version="1.0" encoding="UTF-8"?>' . PHP_EOL . '<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" ' . 'xmlns:xsd="http://www.w3.org/2001/XMLSchema" ' . 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ' . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">' . '<env:Body xmlns:rpc="http://www.w3.org/2003/05/soap-rpc">' . '<env:testFunc2Response env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">' . '<rpc:result>testFunc2Return</rpc:result>' . '<testFunc2Return xsi:type="xsd:string">Hello World!</testFunc2Return>' . '</env:testFunc2Response>' . '</env:Body>' . '</env:Envelope>' . PHP_EOL; $this->assertEquals($client->getLastResponse(), $expectedResponse); }