/** * Test to verify if annotations are added correctly */ public function testAddAnnotationToComplexType() { $dom = new \DOMDocument(); $this->_wsdl->expects($this->any())->method('toDomDocument')->will($this->returnValue($dom)); $annotationDoc = "test doc"; $complexType = $dom->createElement(Wsdl::XSD_NS . ':complexType'); $complexType->setAttribute('name', 'testRequest'); $this->_strategy->addAnnotation($complexType, $annotationDoc); $this->assertEquals($annotationDoc, $complexType->getElementsByTagName("xsd:documentation")->item(0)->nodeValue); }
/** * Add WSDL elements related to generic SOAP fault, which are common for all operations: element, type and message. * * @param Wsdl $wsdl * @return string Default fault message name */ protected function _addGenericFaultComplexTypeNodes($wsdl) { $faultMessageName = Fault::NODE_DETAIL_WRAPPER; $complexTypeName = $this->getElementComplexTypeName($faultMessageName); $wsdl->addElement(['name' => $faultMessageName, 'type' => Wsdl::TYPES_NS . ':' . $complexTypeName]); $faultParamsComplexType = Fault::NODE_DETAIL_PARAMETER; $faultParamsData = ['parameters' => [Fault::NODE_DETAIL_PARAMETER_KEY => ['type' => 'string', 'required' => true, 'documentation' => ''], Fault::NODE_DETAIL_PARAMETER_VALUE => ['type' => 'string', 'required' => true, 'documentation' => '']]]; $wrappedErrorComplexType = Fault::NODE_DETAIL_WRAPPED_ERROR; $wrappedErrorData = ['parameters' => [Fault::NODE_DETAIL_WRAPPED_ERROR_MESSAGE => ['type' => 'string', 'required' => true, 'documentation' => ''], Fault::NODE_DETAIL_WRAPPED_ERROR_PARAMETERS => ['type' => "{$faultParamsComplexType}[]", 'required' => false, 'documentation' => 'Message parameters.']]]; $genericFaultTypeData = ['parameters' => [Fault::NODE_DETAIL_TRACE => ['type' => 'string', 'required' => false, 'documentation' => 'Exception calls stack trace.'], Fault::NODE_DETAIL_PARAMETERS => ['type' => "{$faultParamsComplexType}[]", 'required' => false, 'documentation' => 'Additional exception parameters.'], Fault::NODE_DETAIL_WRAPPED_ERRORS => ['type' => "{$wrappedErrorComplexType}[]", 'required' => false, 'documentation' => 'Additional wrapped errors.']]]; $this->typeProcessor->setTypeData($faultParamsComplexType, $faultParamsData); $this->typeProcessor->setTypeData($wrappedErrorComplexType, $wrappedErrorData); $this->typeProcessor->setTypeData($complexTypeName, $genericFaultTypeData); $wsdl->addComplexType($complexTypeName); $wsdl->addMessage($faultMessageName, ['messageParameters' => ['element' => Wsdl::TYPES_NS . ':' . $faultMessageName]]); return Wsdl::TYPES_NS . ':' . $faultMessageName; }