51 $this->_wsdlFactory = $wsdlFactory;
64 protected function generateSchema($requestedServiceMetadata, $requestScheme, $requestHost, $endPointUrl)
66 $wsdl = $this->_wsdlFactory->create(self::WSDL_NAME, $endPointUrl);
67 $wsdl->addSchemaTypeSection();
71 foreach ($requestedServiceMetadata as $serviceClass => &$serviceData) {
74 $portType = $wsdl->addPortType($portTypeName);
75 $binding = $wsdl->addBinding($bindingName, Wsdl::TYPES_NS .
':' . $portTypeName);
76 $wsdl->addSoapBinding($binding,
'document',
'http://schemas.xmlsoap.org/soap/http', SOAP_1_2);
79 $wsdl->addService($serviceName, $portName, Wsdl::TYPES_NS .
':' . $bindingName, $endPointUrl, SOAP_1_2);
82 $operationName = $this->typeProcessor->getOperationName($serviceClass, $methodName);
83 $bindingDataPrototype = [
'use' =>
'literal'];
84 $inputBinding = $bindingDataPrototype;
87 $outputMessageName =
false;
88 $outputBinding =
false;
89 if (isset($methodData[
'interface'][
'out'][
'parameters'])) {
90 $outputBinding = $bindingDataPrototype;
95 $wsdl->addPortOperation(
102 $bindingOperation = $wsdl->addBindingOperation(
110 $wsdl->addSoapOperation($bindingOperation, $operationName, SOAP_1_2);
113 return $wsdl->toXML();
124 foreach ($this->serviceTypeList->getDataTypes() as $customAttributeClass) {
125 $typeName = $this->typeProcessor->register($customAttributeClass);
126 $wsdl->addComplexType($this->typeProcessor->getArrayItemType($typeName));
143 $inputParameters = [];
145 'name' => $inputMessageName,
146 'type' => Wsdl::TYPES_NS .
':' . $complexTypeName,
148 if (isset($methodData[
'interface'][
'in'][
'parameters'])) {
149 $inputParameters = $methodData[
'interface'][
'in'][
'parameters'];
151 $elementData[
'nillable'] =
'true';
153 $wsdl->addElement($elementData);
155 $callInfo[
'requiredInput'][
'yes'][
'calls'] = [$operationName];
157 'documentation' => $methodData[
'documentation'],
158 'parameters' => $inputParameters,
159 'callInfo' => $callInfo,
161 $this->typeProcessor->setTypeData($complexTypeName, $typeData);
162 $wsdl->addComplexType($complexTypeName);
166 'messageParameters' => [
167 'element' => Wsdl::TYPES_NS .
':' . $inputMessageName,
171 return Wsdl::TYPES_NS .
':' . $inputMessageName;
188 'name' => $outputMessageName,
189 'type' => Wsdl::TYPES_NS .
':' . $complexTypeName,
193 $callInfo[
'returned'][
'always'][
'calls'] = [$operationName];
195 'documentation' => sprintf(
'Response container for the %s call.', $operationName),
196 'parameters' => $methodData[
'interface'][
'out'][
'parameters'],
197 'callInfo' => $callInfo,
199 $this->typeProcessor->setTypeData($complexTypeName, $typeData);
200 $wsdl->addComplexType($complexTypeName);
204 'messageParameters' => [
205 'element' => Wsdl::TYPES_NS .
':' . $outputMessageName,
209 return Wsdl::TYPES_NS .
':' . $outputMessageName;
220 return $serviceName .
'PortType';
231 return $serviceName .
'Binding';
242 return $serviceName .
'Port';
253 return $serviceName .
'Service';
264 return $operationName .
'Request';
275 return $operationName .
'Response';
290 'name' => $faultMessageName,
291 'type' => Wsdl::TYPES_NS .
':' . $complexTypeName,
300 'documentation' =>
'',
305 'documentation' =>
'',
310 $wrappedErrorData = [
315 'documentation' =>
'',
318 'type' =>
"{$faultParamsComplexType}[]",
320 'documentation' =>
'Message parameters.',
324 $genericFaultTypeData = [
329 'documentation' =>
'Exception calls stack trace.',
332 'type' =>
"{$faultParamsComplexType}[]",
334 'documentation' =>
'Additional exception parameters.',
337 'type' =>
"{$wrappedErrorComplexType}[]",
339 'documentation' =>
'Additional wrapped errors.',
343 $this->typeProcessor->setTypeData($faultParamsComplexType, $faultParamsData);
344 $this->typeProcessor->setTypeData($wrappedErrorComplexType, $wrappedErrorData);
345 $this->typeProcessor->setTypeData($complexTypeName, $genericFaultTypeData);
346 $wsdl->addComplexType($complexTypeName);
350 'messageParameters' => [
351 'element' => Wsdl::TYPES_NS .
':' . $faultMessageName,
356 return Wsdl::TYPES_NS .
':' . $faultMessageName;
367 return $this->serviceMetadata->getServiceMetadata($serviceName);
375 $allowedServicesMetadata = parent::getAllowedServicesMetadata($requestedServices);
376 if (!$allowedServicesMetadata) {
379 "The consumer isn't authorized to access %resources.",
380 [
'resources' => implode(
', ', $requestedServices)]
384 return $allowedServicesMetadata;
getInputMessageName($operationName)
generateSchema($requestedServiceMetadata, $requestScheme, $requestHost, $endPointUrl)
getServiceMetadata($serviceName)
getPortTypeName($serviceName)
_addGenericFaultComplexTypeNodes($wsdl)
getAllowedServicesMetadata($requestedServices)
const NODE_DETAIL_WRAPPED_ERROR_MESSAGE
getBindingName($serviceName)
const NODE_DETAIL_WRAPPED_ERROR_PARAMETERS
__construct(\Magento\Webapi\Model\Cache\Type\Webapi $cache, \Magento\Framework\Reflection\TypeProcessor $typeProcessor, \Magento\Framework\Webapi\CustomAttribute\ServiceTypeListInterface $serviceTypeList, \Magento\Webapi\Model\ServiceMetadata $serviceMetadata, Authorization $authorization, WsdlFactory $wsdlFactory)
_createOperationInput(Wsdl $wsdl, $operationName, $methodData)
_createOperationOutput(Wsdl $wsdl, $operationName, $methodData)
const NODE_DETAIL_WRAPPER
addCustomAttributeTypes($wsdl)
getPortName($serviceName)
getOutputMessageName($operationName)
const NODE_DETAIL_PARAMETER_VALUE
getServiceName($serviceName)
const NODE_DETAIL_PARAMETER
const NODE_DETAIL_PARAMETERS
getElementComplexTypeName($messageName)
const NODE_DETAIL_PARAMETER_KEY
const NODE_DETAIL_WRAPPED_ERRORS
const NODE_DETAIL_WRAPPED_ERROR