Example #1
0
 /**
  * Actual "do request" method.
  *
  * @internal
  * @param \Zend\Soap\Client\Common $client
  * @param string $request
  * @param string $location
  * @param string $action
  * @param int    $version
  * @param int    $one_way
  * @return mixed
  */
 public function _doRequest(Common $client, $request, $location, $action, $version, $one_way = null)
 {
     // Perform request as is
     ob_start();
     $this->_server->handle($request);
     $response = ob_get_contents();
     ob_end_clean();
     return $response;
 }
Example #2
0
 /**
  * @group ZF-5300
  */
 public function testSetAndGetWSDLCache()
 {
     $server = new Server\Server();
     $this->assertNull($server->getWSDLCache());
     $server->setWSDLCache(100);
     $this->assertEquals(100, $server->getWSDLCache());
     $options = $server->getOptions();
     $this->assertTrue(isset($options['cache_wsdl']));
     $this->assertEquals(100, $options['cache_wsdl']);
 }
Example #3
0
 public function testSetInputHeaders()
 {
     if (headers_sent()) {
         $this->markTestSkipped('Cannot run testSetInputHeaders() when headers have already been sent; enable output buffering to run this test');
         return;
     }
     $server = new Server\Server(dirname(__FILE__) . '/_files/wsdl_example.wsdl');
     $server->setClass('Zend_Soap_Client_TestClass');
     $client = new Client\Local($server, dirname(__FILE__) . '/_files/wsdl_example.wsdl');
     // Add request header
     $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader1', 'SOAP header content 1'));
     // Add permanent request header
     $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader2', 'SOAP header content 2'), true);
     // Perform request
     $client->testFunc2('World');
     $expectedRequest = '<?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:ns1="http://www.example.com/namespace" ' . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">' . '<env:Header>' . '<ns1:MyHeader2>SOAP header content 2</ns1:MyHeader2>' . '<ns1:MyHeader1>SOAP header content 1</ns1:MyHeader1>' . '</env:Header>' . '<env:Body>' . '<env:testFunc2 env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">' . '<who xsi:type="xsd:string">World</who>' . '</env:testFunc2>' . '</env:Body>' . '</env:Envelope>' . "\n";
     $this->assertEquals($client->getLastRequest(), $expectedRequest);
     // Add request header
     $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader3', 'SOAP header content 3'));
     // Perform request
     $client->testFunc2('World');
     $expectedRequest = '<?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:ns1="http://www.example.com/namespace" ' . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">' . '<env:Header>' . '<ns1:MyHeader2>SOAP header content 2</ns1:MyHeader2>' . '<ns1:MyHeader3>SOAP header content 3</ns1:MyHeader3>' . '</env:Header>' . '<env:Body>' . '<env:testFunc2 env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">' . '<who xsi:type="xsd:string">World</who>' . '</env:testFunc2>' . '</env:Body>' . '</env:Envelope>' . "\n";
     $this->assertEquals($client->getLastRequest(), $expectedRequest);
     $client->resetSoapInputHeaders();
     // Add request header
     $client->addSoapInputHeader(new \SoapHeader('http://www.example.com/namespace', 'MyHeader4', 'SOAP header content 4'));
     // Perform request
     $client->testFunc2('World');
     $expectedRequest = '<?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:ns1="http://www.example.com/namespace" ' . 'xmlns:enc="http://www.w3.org/2003/05/soap-encoding">' . '<env:Header>' . '<ns1:MyHeader4>SOAP header content 4</ns1:MyHeader4>' . '</env:Header>' . '<env:Body>' . '<env:testFunc2 env:encodingStyle="http://www.w3.org/2003/05/soap-encoding">' . '<who xsi:type="xsd:string">World</who>' . '</env:testFunc2>' . '</env:Body>' . '</env:Envelope>' . "\n";
     $this->assertEquals($client->getLastRequest(), $expectedRequest);
 }