public function testErrorHandlingOfSoapServerChangesToThrowingSoapFaultWhenInHandleMode() { if (headers_sent()) { $this->markTestSkipped('Cannot run ' . __METHOD__ . '() when headers have already been sent; enable output buffering to run this test'); return; } $server = new Server(); $server->setOptions(array('location' => 'test://', 'uri' => 'http://framework.zend.com')); $server->setReturnResponse(true); // Requesting Method with enforced parameter without it. $request = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ' . 'xmlns:ns1="http://framework.zend.com" ' . '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:testFunc5 />' . '</SOAP-ENV:Body>' . '</SOAP-ENV:Envelope>' . "\n"; $server->setClass('\\ZendTest\\Soap\\TestAsset\\ServerTestClass'); $response = $server->handle($request); $this->assertContains('<SOAP-ENV:Fault><faultcode>Receiver</faultcode><faultstring>Test Message</faultstring></SOAP-ENV:Fault>', $response); }
/** * @runInSeparateProcess */ public function testShouldThrowExceptionIfHandledRequestContainsDoctype() { $server = new Server(); $server->setOptions(array('location' => 'test://', 'uri' => 'http://framework.zend.com')); $server->setReturnResponse(true); $server->setClass('\\ZendTest\\Soap\\TestAsset\\ServerTestClass'); $request = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<!DOCTYPE foo>' . "\n" . '<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" ' . 'xmlns:ns1="http://framework.zend.com" ' . '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:testFunc2>' . '<param0 xsi:type="xsd:string">World</param0>' . '</ns1:testFunc2>' . '</SOAP-ENV:Body>' . '</SOAP-ENV:Envelope>' . "\n"; $response = $server->handle($request); $this->assertContains('Invalid XML', $response->getMessage()); }
public function SOAPServer() { try { if (isset($this->data->wsdl)) { $ad = new AutoDiscover(); $ad->setClass('SOAPService'); $uri = Manager::getAppURL('exemplos', 'zend/soapServer', true); $ad->setURI($uri); $wsdl = $ad->toXML(); $this->renderStream($wsdl); } else { $uri = Manager::getAppURL('exemplos', 'zend/soapServer?wsdl', true); $server = new Server($uri); $server->setSoapVersion(SOAP_1_2); $server->setClass('SOAPService'); $server->setReturnResponse(true); $response = $server->handle(); $this->renderBinary($response); } } catch (Exception $e) { mdump($e->getMessage()); mdump($e->getTraceAsString()); } }