public function setUp() { if (!class_exists('SCA_Bindings_soap_Proxy')) { $this->markTestSkipped("Cannot execute any SCA soap tests as the SCA soap binding is not loaded"); return; } $php = <<<PHP <?php require_once 'SCA/SCA.php'; /** * @service * @binding.soap * @types aaa://PersonNamespace person.xsd */ class HelloPersonService { /** * @param personType \$person aaa://PersonNamespace * @return string */ public function hello(\$person) { return "hello \$person->name, you were born in \$person->pob on \$person->dob"; } } ?> PHP; file_put_contents(dirname(__FILE__) . '/HelloPersonService.php', $php); $service_description = SCA::constructServiceDescription(dirname(__FILE__) . '/HelloPersonService.php'); $wsdl = SCA_Bindings_soap_ServiceDescriptionGenerator::generateDocumentLiteralWrappedWsdl($service_description); file_put_contents(dirname(__FILE__) . '/HelloPersonService.wsdl', $wsdl); $xsd = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="aaa://PersonNamespace" xmlns:PersonNamespace="aaa://PersonNamespace"> <complexType name="personType"> <sequence> <element name="name" type="string"/> <element name="dob" type="string"/> <element name="pob" type="string"/> </sequence> </complexType> </schema> EOF; file_put_contents(dirname(__FILE__) . '/person.xsd', $xsd); }
public function setUp() { if (!class_exists('SCA_Bindings_soap_Proxy')) { $this->markTestSkipped("Cannot execute any SCA soap tests as the SCA soap binding is not loaded"); return; } $php = <<<PHP <?php include_once "SCA/SCA.php"; /** * @service * @binding.soap * @types PersonNamespace person.xsd */ class SoapProxyTest { } ?> PHP; file_put_contents(dirname(__FILE__) . '/SoapProxyTest.php', $php); $service_description = SCA::constructServiceDescription(dirname(__FILE__) . '/SoapProxyTest.php'); $wsdl = SCA_Bindings_soap_ServiceDescriptionGenerator::generateDocumentLiteralWrappedWsdl($service_description); file_put_contents(dirname(__FILE__) . '/SoapProxyTest.wsdl', $wsdl); $xsd = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="PersonNamespace" xmlns:AuthorNS="PersonNamespace"> <complexType name="personType"> <sequence> <element name="name" type="string"/> <element name="dob" type="string"/> <element name="pob" type="string"/> </sequence> </complexType> </schema> EOF; file_put_contents(dirname(__FILE__) . '/person.xsd', $xsd); }
public function testMagicMethodsDontGetGeneratedIntoWsdl() { $service_description = SCA::constructServiceDescription(dirname(__FILE__) . "/Class5.php"); $wsdl = SCA_Bindings_soap_ServiceDescriptionGenerator::generateDocumentLiteralWrappedWsdl($service_description); $this->assertNotContains('<operation name="__construct">', $wsdl); $this->assertNotContains('<operation name="__destruct">', $wsdl); $this->assertNotContains('<operation name="__call">', $wsdl); $this->assertNotContains('<operation name="__get">', $wsdl); $this->assertNotContains('<operation name="__set">', $wsdl); $this->assertNotContains('<operation name="__isset">', $wsdl); $this->assertNotContains('<operation name="__unset">', $wsdl); $this->assertNotContains('<operation name="__sleep">', $wsdl); $this->assertNotContains('<operation name="__wakeup">', $wsdl); $this->assertNotContains('<operation name="__toString">', $wsdl); $this->assertNotContains('<operation name="__set_state">', $wsdl); $this->assertNotContains('<operation name="__clone">', $wsdl); $this->assertNotContains('<operation name="__autoload">', $wsdl); }
public function testSoapHandlerProcessesCorrectCallCorrectly() { global $HTTP_RAW_POST_DATA; // make it look to the component as if it is on the receiving end of a SOAP request $_SERVER['HTTP_HOST'] = 'localhost'; $_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['SCRIPT_FILENAME'] = dirname(__FILE__) . '/SoapHandlerTestComponent.php'; $_SERVER['CONTENT_TYPE'] = 'application/soap+xml'; $HTTP_RAW_POST_DATA = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://SoapHandlerTestComponent"> <SOAP-ENV:Body> <ns1:reverse xmlns="http://SoapHandlerTestComponent" xmlns:tns="http://SoapHandlerTestComponent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="reverse"> <in>IBM</in> </ns1:reverse> </SOAP-ENV:Body> </SOAP-ENV:Envelope> EOF; $handler = new SCA_Bindings_soap_ServiceRequestHandler(); $service_description = SCA::constructServiceDescription(dirname(__FILE__) . '/SoapHandlerTestComponent.php'); ob_start(); set_error_handler('error_handler', E_WARNING); $handler->handle(dirname(__FILE__) . '/SoapHandlerTestComponent.php', $service_description); restore_error_handler(); $out = ob_get_contents(); ob_end_clean(); $this->assertContains('<tns2:reverseReturn>MBI</tns2:reverseReturn>', $out); }
public function setUp() { if (!class_exists('SCA_Bindings_soap_Proxy')) { $this->markTestSkipped("Cannot execute any SCA soap tests as the SCA soap binding is not loaded"); return; } $xsd = <<<EOF <?xml version="1.0" encoding="UTF-8"?> <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="PersonNamespace" xmlns:AuthorNS="PersonNamespace"> <complexType name="personType"> <sequence> <element name="name" type="string"/> <element name="dob" type="string"/> <element name="pob" type="string"/> </sequence> </complexType> </schema> EOF; file_put_contents('person.xsd', $xsd); $php = <<<EOF <?php /** * @service * @binding.soap */ class TypeHandlerTest1 { /** * @param string \$a * @param float \$b * @param integer \$c * @param boolean \$d * @return string */ public function fourargs() {} } ?> EOF; $class_file = './TypeHandlerTest1.php'; file_put_contents($class_file, $php); $service_description = SCA::constructServiceDescription($class_file); $wsdl = SCA_Bindings_soap_ServiceDescriptionGenerator::generateDocumentLiteralWrappedWsdl($service_description); file_put_contents('TypeHandlerTest1.wsdl', $wsdl); $php = <<<EOF <?php /** * @service * @binding.soap * @types PersonNamespace person.xsd */ class TypeHandlerTest2 { /** * @param personType \$p1 PersonNamespace * @return personType PersonNamespace */ public function myMethod() {} } ?> EOF; $class_file = './TypeHandlerTest2.php'; file_put_contents($class_file, $php); $service_description = SCA::constructServiceDescription($class_file); $wsdl = SCA_Bindings_soap_ServiceDescriptionGenerator::generateDocumentLiteralWrappedWsdl($service_description); file_put_contents('TypeHandlerTest2.wsdl', $wsdl); }