Пример #1
0
 /**
  * @param \SimpleXMLElement $node
  *
  * @return \Bundle\WebServiceBundle\ServiceDefinition\Method
  */
 protected function parseMethod(\SimpleXMLElement $node)
 {
     $method = new Method((string) $node['name'], (string) $node['controller']);
     foreach ($node->argument as $argument) {
         $method->getArguments()->add($this->parseArgument($argument));
     }
     $method->setReturn($this->parseType($node->return->type));
     return $method;
 }
 public function processMessage(Method $messageDefinition, $message)
 {
     $result = array();
     $i = 0;
     foreach ($messageDefinition->getArguments() as $argument) {
         $result[$argument->getName()] = $message[$i];
         $i++;
     }
     return $result;
 }
 public function processMessage(Method $messageDefinition, $message)
 {
     if (count($message) > 1) {
         throw new \InvalidArgumentException();
     }
     $result = array();
     $message = $message[0];
     foreach ($messageDefinition->getArguments() as $argument) {
         $result[$argument->getName()] = $message->{$argument->getName()};
     }
     return $result;
 }
 /**
  * Loads a ServiceDefinition from annotations from a class.
  *
  * @param string $class A class name
  * @param string $type  The resource type
  *
  * @return ServiceDefinition A ServiceDefinition instance
  *
  * @throws \InvalidArgumentException When route can't be parsed
  */
 public function load($class, $type = null)
 {
     if (!class_exists($class)) {
         throw new \InvalidArgumentException(sprintf('Class "%s" does not exist.', $class));
     }
     $class = new \ReflectionClass($class);
     $definition = new ServiceDefinition();
     foreach ($class->getMethods() as $method) {
         $wsMethodAnnot = $this->reader->getMethodAnnotation($method, $this->wsMethodAnnotationClass);
         if ($wsMethodAnnot !== null) {
             $wsParamAnnots = $this->reader->getMethodAnnotations($method, $this->wsParamAnnotationClass);
             $wsResultAnnot = $this->reader->getMethodAnnotation($method, $this->wsResultAnnotationClass);
             $serviceMethod = new Method();
             $serviceMethod->setName($wsMethodAnnot->getName($method->getName()));
             $serviceMethod->setController($this->getController($method, $wsMethodAnnot));
             foreach ($wsParamAnnots as $wsParamAnnot) {
                 $serviceArgument = new Argument();
                 $serviceArgument->setName($wsParamAnnot->getName());
                 $serviceArgument->setType(new Type($wsParamAnnot->getPhpType(), $wsParamAnnot->getXmlType()));
                 $serviceMethod->getArguments()->add($serviceArgument);
             }
             if ($wsResultAnnot !== null) {
                 $serviceMethod->setReturn(new Type($wsResultAnnot->getPhpType(), $wsResultAnnot->getXmlType()));
             }
             $definition->getMethods()->add($serviceMethod);
         }
     }
     return $definition;
 }
 public function processMessage(Method $messageDefinition, $message)
 {
     $result = new \stdClass();
     $result->{$messageDefinition->getName() . 'Result'} = $message;
     return $result;
 }
Пример #6
0
 protected function getSoapOperationName(Method $method)
 {
     return $this->definition->getNamespace() . $method->getName();
 }