Response xml format change support with backward compatibility

This commit is contained in:
Michael Veroux 2019-02-11 12:22:13 +01:00
parent 3f2a99adf6
commit bb95a6cb45
3 changed files with 19 additions and 4 deletions

View File

@ -32,7 +32,10 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface
{
$this->typeRepository = $typeRepository;
return $this->processType($messageDefinition->getOutput()->get('return')->getType(), $message);
$parts = $messageDefinition->getOutput()->all();
$part = array_shift($parts);
return $this->processType($part->getType(), $message);
}
private function processType($phpType, $message)

View File

@ -96,6 +96,7 @@ class AnnotationClassLoader extends Loader
}
$serviceReturn = $annotation->getPhpType();
$serviceXmlReturn = $annotation->getXmlType();
}
}
@ -116,7 +117,11 @@ class AnnotationClassLoader extends Loader
throw new \LogicException(sprintf('@Soap\Result non-existent for "%s".', $method->getName()));
}
$serviceMethod->setOutput($this->loadType($serviceReturn));
if (!isset($serviceXmlReturn) || !$serviceXmlReturn) {
$serviceXmlReturn = 'return';
}
$serviceMethod->setOutput($this->loadType($serviceReturn), $serviceXmlReturn);
$definition->addMethod($serviceMethod);
}

View File

@ -63,12 +63,19 @@ class Method
public function addInput($name, $type)
{
$inName = $this->name;
$this->input = new Message($inName);
$this->input->add($name, $type);
}
public function setOutput($type)
public function setOutput($type, $name = 'return')
{
$this->output->add('return', $type);
if ('return' !== $name) {
$this->output = new Message($name);
}
$this->output->add($name, $type);
}
public function getHeaders()