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;
 }
 public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
 {
     $this->typeRepository = $typeRepository;
     $result = array();
     $i = 0;
     foreach ($messageDefinition->getInput()->all() as $argument) {
         if (isset($message[$i])) {
             $result[$argument->getName()] = $this->processType($argument->getType(), $message[$i]);
         }
         $i++;
     }
     return $result;
 }
 public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
 {
     $this->typeRepository = $typeRepository;
     if (count($message) > 1) {
         throw new \InvalidArgumentException();
     }
     $result = array();
     $message = $message[0];
     foreach ($messageDefinition->getInput()->all() as $argument) {
         $result[$argument->getName()] = $this->processType($argument->getType(), $message);
     }
     return $result;
 }
 /**
  * Loads a ServiceDefinition from annotations from a class.
  *
  * @param string $class A class name
  * @param string $type  The resource type
  *
  * @return \BeSimple\SoapBundle\ServiceDefinition\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 Definition\Definition($this->typeRepository);
     $sharedHeaders = array();
     foreach ($this->reader->getClassAnnotations($class) as $annotation) {
         if ($annotation instanceof Annotation\Header) {
             $sharedHeaders[$annotation->getValue()] = $this->loadType($annotation->getPhpType());
         }
     }
     foreach ($class->getMethods() as $method) {
         $serviceHeaders = $sharedHeaders;
         $serviceArguments = array();
         $serviceMethod = $serviceReturn = null;
         foreach ($this->reader->getMethodAnnotations($method) as $annotation) {
             if ($annotation instanceof Annotation\Header) {
                 $serviceHeaders[$annotation->getValue()] = $this->loadType($annotation->getPhpType());
             } elseif ($annotation instanceof Annotation\Param) {
                 $serviceArguments[$annotation->getValue()] = $this->loadType($annotation->getPhpType());
             } elseif ($annotation instanceof Annotation\Method) {
                 if ($serviceMethod) {
                     throw new \LogicException(sprintf('@Soap\\Method defined twice for "%s".', $method->getName()));
                 }
                 $serviceMethod = new Definition\Method($annotation->getValue(), $this->getController($class, $method, $annotation));
             } elseif ($annotation instanceof Annotation\Result) {
                 if ($serviceReturn) {
                     throw new \LogicException(sprintf('@Soap\\Result defined twice for "%s".', $method->getName()));
                 }
                 $serviceReturn = $annotation->getPhpType();
             }
         }
         if (!$serviceMethod && (!empty($serviceArguments) || $serviceReturn)) {
             throw new \LogicException(sprintf('@Soap\\Method non-existent for "%s".', $method->getName()));
         }
         if ($serviceMethod) {
             foreach ($serviceHeaders as $name => $type) {
                 $serviceMethod->addHeader($name, $type);
             }
             foreach ($serviceArguments as $name => $type) {
                 $serviceMethod->addInput($name, $type);
             }
             if (!$serviceReturn) {
                 throw new \LogicException(sprintf('@Soap\\Result non-existent for "%s".', $method->getName()));
             }
             $serviceMethod->setOutput($this->loadType($serviceReturn));
             $definition->addMethod($serviceMethod);
         }
     }
     return $definition;
 }
 public function processMessage(Method $messageDefinition, $message)
 {
     $result = new \stdClass();
     $result->{$messageDefinition->getName() . 'Result'} = $message;
     return $result;
 }
 public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
 {
     $this->typeRepository = $typeRepository;
     //return $this->processType($messageDefinition->getOutput()->get('return')->getType(), $message);
     return $this->processType(current($messageDefinition->getOutput()->all())->getType(), $message);
 }
 public function processMessage(Method $messageDefinition, $message, TypeRepository $typeRepository)
 {
     $this->typeRepository = $typeRepository;
     $headerDefinition = $messageDefinition->getHeaders()->get($this->header);
     return $this->processType($headerDefinition->getType(), $message);
 }
 public function messageProvider()
 {
     $messages = array();
     $messages[] = array(new Definition\Method('no_argument', null), array(), array());
     $method = new Definition\Method('string_argument', null);
     $method->addInput('foo', 'string');
     $messages[] = array($method, array('bar'), array('foo' => 'bar'));
     $method = new Definition\Method('string_int_arguments', null);
     $method->addInput('foo', 'string');
     $method->addInput('bar', 'int');
     $messages[] = array($method, array('test', 20), array('foo' => 'test', 'bar' => 20));
     $method = new Definition\Method('array_string_arguments', null);
     $method->addInput('foo', 'string[]');
     $method->addInput('bar', 'int');
     $strings = new \stdClass();
     $strings->item = array('foo', 'bar', 'barfoo');
     $messages[] = array($method, array($strings, 4), array('foo' => array('foo', 'bar', 'barfoo'), 'bar' => 4));
     $method = new Definition\Method('empty_array', null);
     $method->addInput('foo', 'string[]');
     $messages[] = array($method, array(new \stdClass()), array('foo' => array()));
     return $messages;
 }