public function testCreate() { $wsdlName = 'wsdlName'; $endpointUrl = 'endpointUrl'; $this->_objectManagerMock->expects($this->once())->method('create')->with('Magento\\Webapi\\Model\\Soap\\Wsdl', array('name' => $wsdlName, 'uri' => $endpointUrl)); $this->_soapWsdlFactory->create($wsdlName, $endpointUrl); }
/** * Generate WSDL file based on requested services. * * @param array $requestedServices * @param string $endPointUrl * @return string * @throws \Magento\Webapi\Exception */ protected function _generate($requestedServices, $endPointUrl) { $this->_collectCallInfo($requestedServices); $wsdl = $this->_wsdlFactory->create(self::WSDL_NAME, $endPointUrl); $wsdl->addSchemaTypeSection(); $faultMessageName = $this->_addGenericFaultComplexTypeNodes($wsdl); foreach ($requestedServices as $serviceClass => $serviceData) { $portTypeName = $this->getPortTypeName($serviceClass); $bindingName = $this->getBindingName($serviceClass); $portType = $wsdl->addPortType($portTypeName); $binding = $wsdl->addBinding($bindingName, Wsdl::TYPES_NS . ':' . $portTypeName); $wsdl->addSoapBinding($binding, 'document', 'http://schemas.xmlsoap.org/soap/http', SOAP_1_2); $portName = $this->getPortName($serviceClass); $serviceName = $this->getServiceName($serviceClass); $wsdl->addService($serviceName, $portName, Wsdl::TYPES_NS . ':' . $bindingName, $endPointUrl, SOAP_1_2); foreach ($serviceData['methods'] as $methodName => $methodData) { $operationName = $this->getOperationName($serviceClass, $methodName); $bindingDataPrototype = array('use' => 'literal'); $inputBinding = $bindingDataPrototype; $inputMessageName = $this->_createOperationInput($wsdl, $operationName, $methodData); $outputMessageName = false; $outputBinding = false; if (isset($methodData['interface']['out']['parameters'])) { $outputBinding = $bindingDataPrototype; $outputMessageName = $this->_createOperationOutput($wsdl, $operationName, $methodData); } $faultBinding = array_merge($bindingDataPrototype, array('name' => Fault::NODE_DETAIL_WRAPPER)); $wsdl->addPortOperation($portType, $operationName, $inputMessageName, $outputMessageName, array('message' => $faultMessageName, 'name' => Fault::NODE_DETAIL_WRAPPER)); $bindingOperation = $wsdl->addBindingOperation($binding, $operationName, $inputBinding, $outputBinding, $faultBinding, SOAP_1_2); $wsdl->addSoapOperation($bindingOperation, $operationName, SOAP_1_2); } } return $wsdl->toXML(); }