public function endpointAction() { // disable wsdl cache if (PIMCORE_DEVMODE) { ini_set("soap.wsdl_cache_enabled", "0"); } // create classmappings $classMap = Webservice_Tool::createClassMappings(); // p_r($classMap); die(); // create wsdl // @TODO create a cache here $strategy = new Zend_Soap_Wsdl_Strategy_Composite(array("object[]" => "Zend_Soap_Wsdl_Strategy_AnyType"), "Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex"); $autodiscover = new Zend_Soap_AutoDiscover($strategy); $autodiscover->setClass('Webservice_Service'); $wsdl = $autodiscover->toXml(); //TODO: do we really want to normalize class names since we had to introduce request and response objects anyway? $wsdl = str_replace("Webservice_Data_", "", $wsdl); // normalize classnames $wsdlFile = PIMCORE_SYSTEM_TEMP_DIRECTORY . "/wsdl.xml"; file_put_contents($wsdlFile, $wsdl); chmod($wsdlFile, 0766); // let's go if (isset($_GET["wsdl"])) { header("Content-Type: text/xml; charset=utf8"); echo $wsdl; } else { Pimcore::setAdminMode(); Document::setHideUnpublished(false); Object_Abstract::setHideUnpublished(false); Object_Abstract::setGetInheritedValues(false); try { $server = new Zend_Soap_Server($wsdlFile, array("cache_wsdl" => false, "soap_version" => SOAP_1_2, "classmap" => $classMap)); $server->registerFaultException("Exception"); $server->setClass("Webservice_Service"); $server->handle(); } catch (Exception $e) { Logger::log("Soap request failed"); Logger::log($e); throw $e; } } exit; }
/** * @group ZF-8948 * @group ZF-5766 */ public function testRecursiveWsdlDependencies() { $autodiscover = new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex'); $autodiscover->setClass('Zend_Soap_AutoDiscover_Recursion'); $wsdl = $autodiscover->toXml(); // <types> // <xsd:schema targetNamespace="http://localhost/my_script.php"> // <xsd:complexType name="Zend_Soap_AutoDiscover_Recursion"> // <xsd:all> // <xsd:element name="recursion" type="tns:Zend_Soap_AutoDiscover_Recursion"/> $path = '//wsdl:types/xsd:schema/xsd:complexType[@name="Zend_Soap_AutoDiscover_Recursion"]/xsd:all/xsd:element[@name="recursion" and @type="tns:Zend_Soap_AutoDiscover_Recursion"]'; $this->assertWsdlPathExists($wsdl, $path); }
/** * @group ZF-6689 */ public function testNoReturnIsOneWayCallInAddFunction() { $autodiscover = new Zend_Soap_AutoDiscover(); $autodiscover->addFunction('Zend_Soap_AutoDiscover_OneWay'); $wsdl = $autodiscover->toXml(); $this->assertContains('<operation name="Zend_Soap_AutoDiscover_OneWay"><documentation>@param string $message</documentation><input message="tns:Zend_Soap_AutoDiscover_OneWayIn"/></operation>', $wsdl); }