/** * Parse a WSDL document into a generic object * * @param string|file $wsdl The WSDL document or a filename for the WSDL document to parse * @return Zend_Soap_Wsdl_Parser_Result The contents of the WSDL file */ public static function parse($wsdl) { if (strpos($wsdl, '<') === false) { $wsdl_result = new Zend_Soap_Wsdl_Parser_Result($wsdl); $wsdl = file_get_contents($wsdl); } else { $tmp = new tempnam(ini_get('upload_tmp_dir'), 'ZF_Temp_'); file_put_contents($tmp, $wsdl); $wsdl_result = new Zend_Soap_Wsdl_Parser_Result($tmp); } self::$xml = simplexml_load_string($wsdl); /* This is done so that we have a known prefix to the WSDL elements for XPath queries */ self::$xml['xmlns:zfwsdl'] = 'http://schemas.xmlsoap.org/wsdl/'; self::$xml = simplexml_load_string(self::$xml->asXML()); if (isset(self::$xml->documentation)) { $wsdl_result->documentation = trim(self::$xml->documentation); } if (!isset(self::$xml['name'])) { $wsdl_result->name = null; } else { $wsdl_result->name = (string) self::$xml['name']; } foreach (self::$xml->binding->operation as $operation) { $name = (string) $operation['name']; $wsdl_result->operations[$name] = array(); $wsdl_result->operations[$name]['input'] = self::getOperationInputs($name); $wsdl_result->operations[$name]['output'] = self::getOperationOutput($name); $wsdl_result->operations[$name]['documentation'] = self::getDocs($name); } $wsdl_result->portType = (string) self::$xml->portType['name']; $wsdl_result->binding = (string) self::$xml->binding['name']; $wsdl_result->service['name'] = (string) self::$xml->service['name']; $wsdl_result->service['address'] = (string) self::$xml->service->port->children('http://schemas.xmlsoap.org/wsdl/soap/')->attributes(); $wsdl_result->targetNamespace = (string) self::$xml['targetNamespace']; return $wsdl_result; }