Giter Club home page Giter Club logo

besimplesoapbundle's People

Contributors

alexeymorozov avatar ch3ric avatar christiankerl avatar davefx avatar francisbesset avatar ldantunez avatar lsmith77 avatar matthiasnoback avatar rolebi avatar sarunas avatar vytautasgimbutas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

besimplesoapbundle's Issues

Symfony 2.1 compatibility

I got this error when trying to use the bundle with Symfony > 2.1.

Fatal error: Declaration of BeSimple\SoapBundle\ServiceDefinition\Loader\AnnotationClassLoader::setResolver() must be compatible with that of Symfony\Component\Config\Loader\LoaderInterface::setResolver()

To solve the issue make sure to change the
use Symfony\Component\Config\Loader\LoaderResolver declaration at BeSimple\SoapBundle\ServiceDefinition\Loader\AnnotationClassLoader to
use Symfony\Component\Config\Loader\LoaderResolverInterface

and the method setResolver at line 188 must receive an instance of LoaderResolverInterface instead LoaderResolver.

Sorry about the format, I'm new at Git.

warning "Zend PHP Deprecated: Polyfill autoload"

Zend Stdlib change and now throw a warning due to some requiere in composer
PHP Deprecated: Polyfill autoload support (file library/Zend/Stdlib/compatibility/autoload.php) is no longer necessary; please remove your require statement referencing this file in vendor/zendframework/zend-stdlib/Zend/Stdlib/compatibility/autoload.php on line 14

Another entity association issue

I found another issue today, not sure if I'm doing something wrong but I must have it posted here anyway, thanks.
The environment doesn't matter/ The code below is exactly what I'm testing I only changed namespaces

1 method in Webservice controller

/**
     * @Soap\Param("id", phpType = "int")
     * @Soap\Method("getEnquiry")
     * @Soap\Result(phpType = "MyNamespace\Entity\Category")
     */
    public function getEnquiryAction($id)
    {
        $em = $this->container->get('doctrine')->getEntityManager();

        $quote = $em->find('MyNamespace\Entity\Enquiry', 20);
        $result = $em->find('MyNamespace\Entity\Category', 4);

        $this->container->get('besimple.soap.response')->setReturnValue($result);

        return $this->container->get('besimple.soap.response');
    }

The Enquiry entity has many to one association with Category

The enquiries table

---------
id|category_id
19|4
20|3

The above all work but if I change some values in the method

/**
     * @Soap\Param("id", phpType = "int")
     * @Soap\Method("getEnquiry")
     * @Soap\Result(phpType = "MyNamespace\Entity\Category")
     */
    public function getEnquiryAction($id)
    {
        $em = $this->container->get('doctrine')->getEntityManager();

        $quote = $em->find('MyNamespace\Entity\Enquiry',  19);
        $result = $em->find('MyNamespace\Entity\Category', 4);

        $this->container->get('besimple.soap.response')->setReturnValue($result);

        return $this->container->get('besimple.soap.response');
    }

and exception is thrown


<error code="500" message="Internal Server Error">
    <exception class="ReflectionException" message="Property id does not exist">
        <traces>
            <trace>
                at n/a
                    in /var/www/www2/mini/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php line 76

            </trace>
            <trace>
                at ReflectionClass-&gt;getProperty(&#039;id&#039;)
                    in /var/www/www2/mini/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php line 76

            </trace>

            <trace>
                at BeSimple\SoapBundle\ServiceBinding\RpcLiteralResponseMessageBinder-&gt;checkComplexType(&#039;MyNamespace\Category&#039;, object(Proxies\MyNamespaceEntityCategoryProxy))
                    in /var/www/www2/mini/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php line 54


what can be a problem?

SoapClient

Hello, How do I use the Client-Soap? please have an example? thanks for helping

BeSimpleClient - Tutorial

Hi,
Excellent work.

I am using nusoap lib as soap client. client call is as simple as:

$client = new \nusoap_client('http://wsdl_string"',true);
$param = array('param1' => value1,
        'param2' => value2,
    );

    $result = $soapClient->call('WebServiceMethodName',array(
        'in0' => $param,
    ));

I tried to figure out how to perform the same call with BeSimpleBundle, but I am too new to SOAP.
Could you provide a simple example where those simple steps are invoved with BeSimple\SoapClient\SoapClientBuilder?

So far i have the bundle properly installed and "configured":

    $soapClientBuilder = $this->get('besimple.soap.client.builder.myname');
    $soapClient = $soapClientBuilder->build();
    $sopaClient->?????

Thanks in advanced.

SoapFault : Wrong Version

Hi,

my project is on Symfony 2.0.x and I installed your bundle. I'm working on a local config.

I follow all the steps of configuration and exemple on the doc.

Like in doc, I get a wsdl (file or text) on my url http:/localhost/app_dev.php/soap/return.

The wsdl file seems ok :



Then I put a serviceController :


/*
 * @Route("/soap")
 */
class HelloServiceController extends Controller
{
 
    /**
     * @Route("/hello")
     * @return Response
     * 
     */
    public function indexAction()
    {
        $client = new \soapclient('http://localhost/app_dev.php/soap/return');

        $response = $client->__soapCall('hello', array('name' => 'toto'));

        return $response;
    }
}

And the file which contains the method is :


class ServerController extends ContainerAware
{
 
    /**
     * @return Response
     * @Soap\Method("hello")
     * @Soap\Param("name", phpType = "string")
     * @Soap\Result(phpType = "string")
     * 
     */
    public function helloAction($name)
    {
        return sprintf('Hello %s!', $name);
    }

At the end when I launch the url : http://localhost/app_dev.php/soap/hello

An error occurs : Wrong Version

I have searched for any solutions but nothing found.

Do you have any idea? Thank you.

Routing issue

Hello I followed exactly the instructions from http://besim.pl/ but when I try to hit the url for the web-service is not working :/

app/config/config.yml

be_simple_soap:
    services:
        DemoApi:
            namespace:     http://symfony.sf/app_dev.php/api/DemoApi/1.0/
            binding:       rpc-literal
            resource:      "@AcmeDemoBundle/Controller/ServiceController.php"
            resource_type: annotation

I also tried namespace: http://symfony.sf/api/DemoApi/1.0/, namespace: /DemoApi/1.0/ and namespace: /api/DemoApi/1.0/

app/config/routing.yml

_besimple_soap:
    resource: "@BeSimpleSoapBundle/Resources/config/routing/webservicecontroller.xml"
    prefix:   /api

src/Acme/DemoBundle/Controller/ServiceController.php

<?php
namespace Acme\DemoBundle\Controller;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Symfony\Component\DependencyInjection\ContainerAware;

class ServiceController extends ContainerAware
{
    /**
     * @Soap\Method("hello")
     * @Soap\Param("name", phpType = "string")
     * @Soap\Result(phpType = "string")
     */
    public function helloAction($name)
    {
        return $this->container->get('besimple.soap.response')->setReturnValue(sprintf('Hello %s!', $name));
    }
}

When I point my url to http://symfony.sf/app_dev.php/api/DemoApi/1.0/ or http://symfony.sf/api/DemoApi/1.0/ I'm getting the exception No route found for "GET /api/DemoApi/1.0/"

Thanks in advance for any help :)

Problem using entity type twice

Hi i have problems validating the BeSimpleSoapBundle wsdl when using an Entity twice.

When using the Acme\UserBundle\Entity\User as Result

namespace Acme\APIBundle\Controller;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;

class DefaultController extends ContainerAware
{    

    /**
     * @Soap\Method("getUser")
     * @Soap\Param("name", phpType = "string")
     * @Soap\Result(phpType = "Acme\UserBundle\Entity\User")
     */
     public function getUserAction($name)
    {
        $user = $this->container->get('doctrine')->getRepository('AcmeUserBundle:User')->findOneBy(array(
            'username' => $name,
        ));        

        if (!$user) {
            throw new \SoapFault('USER_NOT_FOUND', sprintf('The user with the name "%s" cannot be found', $name));
        }
        return $user;
    }

     /**
     * @Soap\Method("getSender")
     * @Soap\Param("email", phpType = "string")
     * @Soap\Result(phpType = "Acme\MainBundle\Entity\Sender")
     */
     public function getSenderAction($email)
    {
        $sender = $this->container->get('doctrine')->getRepository('AcmeMainBundle:Sender')->findOneBy(array(
            'email' => $email,
        ));        

        if (!$user) {
            throw new \SoapFault('SENDER_NOT_FOUND', sprintf('The sender with the emailaddress "%s" can not be found', $email));
        }
        return $sender;
    }
}

and as relation in an Entity

namespace Acme\MainBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use BeSimple\SoapCommon\Type\AbstractKeyValue;

/**
 * Sender
 *
 * @ORM\Table(name="sender")
 * @ORM\Entity
 */
class Sender
{
    /**
     * @var integer
     * @Soap\ComplexType("int")
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    protected $id;

    /**
     * @var string
     * @Soap\ComplexType("string")
     * @ORM\Column(name="email", type="string", length=255, nullable=true)
     */
    protected $email;

    /**
     * @var \FosUser
     * @Soap\ComplexType("\Acme\UserBundle\Entity\User") 
     * @ORM\ManyToOne(targetEntity="\Acme\UserBundle\Entity\User")
     * @ORM\JoinColumns({
     *   @ORM\JoinColumn(name="user", referencedColumnName="id", onDelete="CASCADE")
     * })
     */

    protected $user;



    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set email
     *
     * @param string $email
     * @return Sender
     */
    public function setEmail($email)
    {
        $this->email = $email;

        return $this;
    }

    /**
     * Get email
     *
     * @return string 
     */
    public function getEmail()
    {
        return $this->email;
    }

    /**
     * Set user
     *
     * @param \Acme\UserBundle\Entity\User $user
     * @return Sender
     */
    public function setUser(\Acme\UserBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Get user
     *
     * @return \Acme\UserBundle\Entity\User
     */
    public function getUser()
    {
        return $this->user;
    }

    function __toString() {
        return $this->getEmail();
    }
}

The Entitytype is generated twice in the wsdl

<types>
    <xsd:schema targetNamespace="">
    <xsd:complexType name="Acme.UserBundle.Entity.User">
        <xsd:all>
          <xsd:element name="id" type="xsd:int"/>
          <xsd:element name="username" type="xsd:string"/>
          <xsd:element name="usernameCanonical" type="xsd:string"/>
          <xsd:element name="email" type="xsd:string"/>
          <xsd:element name="emailCanonical" type="xsd:string"/>
          <xsd:element name="enabled" type="xsd:boolean"/>
          <xsd:element name="salt" type="xsd:string"/>
          <xsd:element name="password" type="xsd:string"/>
          <xsd:element name="plainPassword" type="xsd:string" nillable="true"/>
          <xsd:element name="lastLogin" type="xsd:dateTime" nillable="true"/>
          <xsd:element name="confirmationToken" type="xsd:string" nillable="true"/>
          <xsd:element name="passwordRequestedAt" type="xsd:dateTime" nillable="true"/>
          <xsd:element name="groups" type="tns:ArrayOfString" nillable="true"/>
          <xsd:element name="locked" type="xsd:boolean" nillable="true"/>
          <xsd:element name="expired" type="xsd:boolean" nillable="true"/>
          <xsd:element name="expiresAt" type="xsd:dateTime" nillable="true"/>
          <xsd:element name="roles" type="tns:ArrayOfString" nillable="true"/>
          <xsd:element name="credentialsExpired" type="xsd:boolean" nillable="true"/>
          <xsd:element name="credentialsExpireAt" type="xsd:string" nillable="true"/>
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="Acme.UserBundle.Entity.User">
        <xsd:all>
          <xsd:element name="id" type="xsd:int"/>
          <xsd:element name="username" type="xsd:string"/>
          <xsd:element name="usernameCanonical" type="xsd:string"/>
          <xsd:element name="email" type="xsd:string"/>
          <xsd:element name="emailCanonical" type="xsd:string"/>
          <xsd:element name="enabled" type="xsd:boolean"/>
          <xsd:element name="salt" type="xsd:string"/>
          <xsd:element name="password" type="xsd:string"/>
          <xsd:element name="plainPassword" type="xsd:string" nillable="true"/>
          <xsd:element name="lastLogin" type="xsd:dateTime" nillable="true"/>
          <xsd:element name="confirmationToken" type="xsd:string" nillable="true"/>
          <xsd:element name="passwordRequestedAt" type="xsd:dateTime" nillable="true"/>
          <xsd:element name="groups" type="tns:ArrayOfString" nillable="true"/>
          <xsd:element name="locked" type="xsd:boolean" nillable="true"/>
          <xsd:element name="expired" type="xsd:boolean" nillable="true"/>
          <xsd:element name="expiresAt" type="xsd:dateTime" nillable="true"/>
          <xsd:element name="roles" type="tns:ArrayOfString" nillable="true"/>
          <xsd:element name="credentialsExpired" type="xsd:boolean" nillable="true"/>
          <xsd:element name="credentialsExpireAt" type="xsd:string" nillable="true"/>
        </xsd:all>
      </xsd:complexType>
      <xsd:complexType name="Acme.MainBundle.Entity.Sender">
        <xsd:all>
          <xsd:element name="id" type="xsd:int"/>
          <xsd:element name="email" type="xsd:string"/>
          <xsd:element name="user" type="tns:Acme.UserBundle.Entity.User"/>
        </xsd:all>
      </xsd:complexType>
    </xsd:schema>
</types>

Empty array problem

The SoapBundle crashes when I try to send empty arrays.

Request :

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://acme.lxc/ws/DemoApi/1.0/" xmlns:ns2="http://acme.lxc/">
  <SOAP-ENV:Body>
    <ns1:setAgendaEvents>
      <agenda_id>5</agenda_id>
      <agenda_event_list/>
    </ns1:setAgendaEvents>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Error :

<error code="500" message="Internal Server Error">
   <exception class="ErrorException" message="Notice: Undefined property: stdClass::$item in /var/www/acme/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php line 60">
      <traces>
         <trace>at n/a
                    in /var/www/acme/trunk/symfony/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php line 65</trace>
         <trace>at Symfony\Component\HttpKernel\Debug\ErrorHandler->handle('8', 'Undefined property: stdClass::$item', '/var/www/acme/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php', '60', array('phpType' => 'Acme\WebServicesBundle\Entity\AgendaEvent', 'message' => object(stdClass), 'isArray' => true, 'match' => array('Acme\WebServicesBundle\Entity\AgendaEvent[]', 'Acme\WebServicesBundle\Entity\AgendaEvent'), 'array' => array()))
                    in /var/www/acme/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php line 60</trace>
         <trace>at BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestMessageBinder->processType('Acme\WebServicesBundle\Entity\AgendaEvent[]', object(stdClass))
                    in /var/www/acme/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralRequestMessageBinder.php line 37</trace>
         <trace>at BeSimple\SoapBundle\ServiceBinding\RpcLiteralRequestMessageBinder->processMessage(object(BeSimple\SoapBundle\ServiceDefinition\Method), array('5', object(stdClass)), array('Acme\WebServicesBundle\Entity\Agenda' => object(BeSimple\SoapBundle\Util\Collection), 'Acme\WebServicesBundle\Entity\AgendaEvent' => object(BeSimple\SoapBundle\Util\Collection), 'Acme\WebServicesBundle\Entity\AgendaSlot' => object(BeSimple\SoapBundle\Util\Collection), 'Acme\WebServicesBundle\Entity\SecurityToken' => object(BeSimple\SoapBundle\Util\Collection)))
                    in /var/www/acme/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/ServiceBinder.php line 79</trace>
         <trace>at BeSimple\SoapBundle\ServiceBinding\ServiceBinder->processServiceMethodArguments('setAgendaEvents', array('5', object(stdClass)))
                    in /var/www/acme/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/Controller/SoapWebServiceController.php line 115</trace>
         <trace>at BeSimple\SoapBundle\Controller\SoapWebServiceController->__call('setAgendaEvents', array('5', object(stdClass)))
                    in  line</trace>
         <trace>at BeSimple\SoapBundle\Controller\SoapWebServiceController->setAgendaEvents('5', object(stdClass))
                    in  line</trace>
         <trace><![CDATA[at SoapServer->handle('<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://acme.lxc/ws/DemoApi/1.0/">
   <soapenv:Body>
      <ns:setAgendaEvents>
         <agenda_id>5</agenda_id>
         <agenda_event_list/>
      </ns:setAgendaEvents>
   </soapenv:Body>
</soapenv:Envelope>')
                    in /var/www/acme/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/Controller/SoapWebServiceController.php line 66]]></trace>
         <trace>at BeSimple\SoapBundle\Controller\SoapWebServiceController->callAction('DemoApi')
                    in  line</trace>
         <trace>at call_user_func_array(array(object(BeSimple\SoapBundle\Controller\SoapWebServiceController), 'CallAction'), array('DemoApi'))
                    in /var/www/acme/trunk/symfony/app/cache/dev/classes.php line 4372</trace>
         <trace>at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Symfony\Component\HttpFoundation\Request), '1')
                    in /var/www/acme/trunk/symfony/app/cache/dev/classes.php line 4342</trace>
         <trace>at Symfony\Component\HttpKernel\HttpKernel->handle(object(Symfony\Component\HttpFoundation\Request), '1', true)
                    in /var/www/acme/trunk/symfony/app/cache/dev/classes.php line 5277</trace>
         <trace>at Symfony\Bundle\FrameworkBundle\HttpKernel->handle(object(Symfony\Component\HttpFoundation\Request), '1', true)
                    in /var/www/acme/trunk/symfony/app/bootstrap.php.cache line 547</trace>
         <trace>at Symfony\Component\HttpKernel\Kernel->handle(object(Symfony\Component\HttpFoundation\Request))
                    in /var/www/acme/trunk/symfony/web/app_dev.php line 22</trace>
      </traces>
   </exception>
</error>

Problem : No returns entity data : @Soap\Result(phpType = "My\App\Entity\User")

Problem : No returns entity data : @soap\Result(phpType = "My\App\Entity\Moneda")

Error Notice: Undefined index: in D:\Proyectos\wsnusoap\lib\nusoap.php on line 6636

My\App\Controller MyAppController.php

<?php
namespace My\App\Controller;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Symfony\Component\DependencyInjection\ContainerAware;

class DemoController extends ContainerAware
{           
    /**
     * @Soap\Method("getMoneda")
     * @Soap\Param("name", phpType = "string")
     * @Soap\Result(phpType = "My\App\Entity\Moneda")
     */
    public function getMonedaAction($name)
    {
        $em = $this->container->get('doctrine')->getEntityManager();
        $moneda = $em->getRepository('MyApp:Moneda')->findAll();

        if (!$moneda) {
            throw new \SoapFault('USER_NOT_FOUND', sprintf('The user with the name "%s" can not be found', $name));
        }

        return $this->container->get('besimple.soap.response')->setReturnValue($moneda);
    }
}

?>

My\App\Entity\Moneda.php

<?php

namespace My\App\Entity;
use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table(name="moneda")
 * @ORM\Entity(repositoryClass="My\App\Entity\MonedaRepository")    
 */

 class Moneda
 {
     /**   
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="IDENTITY")
     * @Soap\ComplexType("int")
     */
     public $id;

     /**     
      * @ORM\Column(type="string",length="50",unique="true")     
      * @Soap\ComplexType("string")
      */
     public $nombre;

     /**     
      * @ORM\Column(type="string",length="5")     
      * @Soap\ComplexType("string")
      */
     public $sigla;

     public function __toString()
     {
         return $this->getNombre();
     }

     /**
      * Get id
      *
      * @return integer 
      */
     public function getId()
     {
         return $this->id;
     }

     /**
      * Set nombre
      *
      * @param string $nombre
      */
     public function setNombre($nombre)
     {
         $this->nombre = $nombre;
     }

     /**
      * Get nombre
      *
      * @return string 
      */
     public function getNombre()
     {
         return $this->nombre;
     }

     /**
      * Set sigla
      *
      * @param string $sigla
      */
     public function setSigla($sigla)
     {
         $this->sigla = $sigla;
     }

     /**
      * Get sigla
      *
      * @return string 
      */
     public function getSigla()
     {
         return $this->sigla;
     }

}

Cliente.php

?>

<?php
include('lib/nusoap.php');

$wsdl = "http://localhost/symfony/web/app.php/ws/DemoApi?wsdl";
$client = new nusoap_client($wsdl,'wsdl');

// Check for an error
$err = $client->getError();
if ($err) {
// Display the error
echo '<h2>Constructor error</h2><pre>' . $err . '</pre>';
// At this point, you know the call that follows will fail
}

$parametro = array('name' => 'Euro');
$result = $client->call('getMoneda', $parametro);

print_r($result);

?>

phpType classes with inheritance

Hi,

Would it be possible to have Param and Result phpType objects take advantage of inheritance?

I would like to define a BaseRequest and BaseResponse classes with some shared properties for all soap methods, but at the moment this does not look to be supported.

Cheers,
Ben

wsdl format

Hello.

Is possible to generate wsdl in the same format as ckWebServicePlugin did?

becouse i can't call any
php SoapClient it says SoapFault exception: [VersionMismatch] Wrong Version
and desctop soap request tool can't read generated wsdl

please help me figure out what is wrong?

HTTP Error: Unsupported HTTP response status 503 Service Unavailable (soapclient->response has contents of the response)

Within the "helloAction" desire validate the user name, for that add the following code:

 <?php
namespace My\App\Controller;

  use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
  use Symfony\Component\DependencyInjection\ContainerAware;

  class DemoController extends ContainerAware
  {
      /**
     * @Soap\Method("hello")
    * @Soap\Param("name", phpType = "string")
    * @Soap\Result(phpType = "string")
    */
     public function helloAction($name)
     {
         $user = $this->container->getDoctrine()->getRepository('MyApp:User')->findOneBy(array(
    'name' => $name,));

         if (!$user) {
              throw new \SoapFault('USER_NOT_FOUND', sprintf('El nombre no se encuentra registrado', $name));
         }
         return $this->container->get('besimple.soap.response')->setReturnValue(sprintf('Hello %s!', $name));
   }

}
?>

When the Web services cosumir I get this error message:

 Error

HTTP Error: Unsupported HTTP response status 503 Service Unavailable (soapclient->response has contents of the response)

What is happening?

Fatal error: Declaration error

just installed latest packages from git symfony/etc
project itself is working (AcmeDemo etc)
but when enable BeSimpleSoapBundle

get this error

Fatal error: Declaration of BeSimple\SoapBundle\ServiceDefinition\Loader\AnnotationClassLoader::setResolver() must be compatible with that of Symfony\Component\Config\Loader\LoaderInterface::setResolver() in /usr/local/symfony2/symfony/bundles/BeSimple/SoapBundle/ServiceDefinition/Loader/AnnotationClassLoader.php on line 29

it's self explanatory
@francisbesset can you update that please and merge to master?

Getting "Array" in a string parameter

Hi!

I'm starting using BeSimple and have configured it correctly. I can call the WS and get results. My problem is, I have this service with a string parameter that seems to have an "Array" value independently of what I put inside.

Here's the service controller:

container->get('besimple.soap.response')->setReturnValue("Hello: ". $name); } ``` } and this is the call I make: try { $client = new SoapClient($url); $result=$client->hello(array('names'=>$_POST['aplicacion'])); echo "Resultado:\n"; print_r($result); } catch(Exception $e) { echo "Excepciรณn:\n"; print_r($e); ``` } ``` Independently of the content of $_POST['aplicacion'], I always get this result: Resultado: Hello: Array Am I missing something? Thanks!

Class 'Zend\Soap\Wsdl' not found on web server

I'm trying to create a web service project in my web server but it generates the error:

Fatal error: Class 'Zend\Soap\Wsdl' not found in /home/site/public_html/symfony/vendor/bundles/BeSimple/SoapBundle/ServiceDefinition/Dumper/Wsdl.php on line 21

The BesimpleSoapBundle work correctly on localhost but not on my web server
Pleace help me on this issue

SoapHeader handling

Hello again,

I try to access the SoapHeader sent in the SOAP request in me web service controller, but I don't manage to do it. I tried to inherit my Controller from BeSimple\SoapBundle\Controller\SoapWebServiceController, but $this->soapRequest is always NULL.

I also saw an occurence of SoapHeader in the fixtures of the bundle "BeSimple/SoapBundle/Tests/fixtures/Soap/api.wsdl" for the method "SimpleMultiplyWithHeader" but there is no other reference of this method in the code.

What should I do to access SoapHeaders ?

Thanks in advance !

Empty parts attribute for soap:body in operation

The same problem as #16 but with other field. Here is a patch:

diff --git a/ServiceDefinition/Dumper/WsdlDumper.php b/ServiceDefinition/Dumper/WsdlDumper.php
index 97517f7..76bc35d 100644
--- a/ServiceDefinition/Dumper/WsdlDumper.php
+++ b/ServiceDefinition/Dumper/WsdlDumper.php
@@ -80,17 +80,25 @@ class WsdlDumper implements DumperInterface
             );
             $portOperation->setAttribute('parameterOrder', implode(' ', array_keys($requestParts)));

-            $baseBinding = array(
+            $baseBinding = $inputBinding = $outputBinding = array(
                 'use'           => 'literal',
                 'namespace'     => $definition->getNamespace(),
                 'encodingStyle' => 'http://schemas.xmlsoap.org/soap/encoding/',
             );

+            if (!empty($requestParts)) {
+                $inputBinding['parts'] = implode(' ', array_keys($requestParts));
+            }
+
+            if (!empty($responseParts)) {
+                $outputBinding['parts'] = implode(' ', array_keys($responseParts));
+            }
+
             $bindingOperation = $this->wsdl->addBindingOperation(
                 $binding,
                 $method->getName(),
-                array_merge(array('parts' => implode(' ', array_keys($requestParts))), $baseBinding),
-                array_merge(array('parts' => implode(' ', array_keys($responseParts))), $baseBinding)
+                $inputBinding,
+                $outputBinding
             );
             $bindingOperation = $this->wsdl->addBindingOperationHeader(
                 $bindingOperation,

Embedded documents loading

Hi, I'm using Doctrine ODM with mongoDB.
This webservice will manage users and their resumes.
I've successfully created a soap webservice to do some basic operations on simple documents.
However I've have a problem when it comes to work with embedded documents.

Each time I try to load a document without the embedded document (A user without any attached resume), an error is thrown:
request.CRITICAL: ErrorException: Warning: spl_object_hash() expects parameter 1 to be object, null given in /var/www/Symfony/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php line 66 (uncaught exception) at /var/www/Symfony/vendor/symfony/src/Symfony/Component/HttpKernel/Debug/ErrorHandler.php line 65 [] []

If I try to load a document with the embedded document (A user with an attched resume) the the service works fine and return a User object with a Resume Object inside it.

In my user class I've set the resume property (as embedded document in mongodb) to nillable, but no effect on this bug.
/**
* @mongodb\EmbedOne(targetDocument="Resume")
* @soap\ComplexType("Sem\CvtBundle\Document\Resume", nillable=true)
*
*/
private $resume;

If I try with the "regular" symfony2 app, the problem wont occur and will load users even if they don't have a resume attached.

Thx in advance for your help.

Pass headers to curl-request

I need special headers in my requests to the soap-server.

I have tried to pass my headers in the options-array of your soap-client, but is doesn't work.

$httpHeaders = array('http' => array( 'header'=>'test: test\r\n' )); $soapOptions['stream_context'] = stream_context_create($httpHeaders); $client = new BeSimpelSoapClient($wsdl, $soapOptions);

It works when I add my headers to the headers-array in your soap-client. But it isn't a solution for me.

A method like addHttpHeader would be very helpful.

Expose a complex type with a pretty name

First off, thanks a bunch for this fantastic bundle!

Currently, itโ€™s possible to make PHP classes available as complex types. E.g., as a SOAP parameter:

/**
 * ...
 * @Soap\Param("post", phpType = "My\BlogBundle\Entity\Post")
 * ...
 */

The namespace for the PHP class is then also used in the WSDL. So our Post entity becomes complex type My.BlogBundle.Entity.Post. I think this looks rather ugly. Would it be possible to expose a PHP class with another name and namespace? In this case that could be SoapPost or something similar. Perhaps something like the following?

/**
 * ...
 * @Soap\Param("post", phpType = "My\BlogBundle\Entity\Post", name="SoapPost")
 * ...
 */

Test WSDL failed

Hello,

I'm a newbee in sf2. I setup my BeSimpleSoapBundle by following all the step on the official website but i'm getting this Error:

Fatal error: Call to a member function setName() on a non-object in /home/workspace/vendor/bundles/BeSimple/SoapBundle/WebServiceContext.php on line 69

Here is my configuration

app/config/config.yml

be_simple_soap:
    cache:
        type:     disk
        lifetime: 86400
        limit:    5

be_simple_soap:
    services:
        DemoApi:
            namespace:     http://eresto.local/app_dev/ws/DemoApi/1.0/
            binding:       rpc-literal
            resource:      "@TecnokeyShopBundle/Controller/ServiceController.php"
            resource_type: annotation

app/config/routing.yml

_besimple_soap:
    resource: "@BeSimpleSoapBundle/Resources/config/routing/webservicecontroller.xml"
    prefix:   /ws

src/Tecnokey/ShopBundle/Controller/ServiceController.php

namespace Tecnokey\ShopBundle\Controller;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Symfony\Component\DependencyInjection\ContainerAware;

class ServiceController extends ContainerAware
{
    /**
     * @Soap\Method("hello")
     * @Soap\Param("name", phpType = "string")
     * @Soap\Result(phpType = "string")
     */
    public function helloAction($name)
    {
        return $this->container->get('besimple.soap.response')->setReturnValue(sprintf('Hello %s!', $name));
    }
}

Could you please help me to solve this out ?

thanks for the help.

Empty parameterOrder attribute for operation tag

Hello,

When I have a soap method without any parameters, the WSDL operation tag it's generated with the attribute parameterOrder empty. When trying to load the file with .NET wsdl.exe I get This web service does not conform to WS-I Basic Profile v1.1.

Looking at WS-I Basic Profile v1.1 specification, I found this phase:

R2305 A wsdl:operation element child of a wsdl:portType element in a DESCRIPTION MUST be constructed so that the parameterOrder attribute, if present, omits at most 1 wsdl:part from the output message.

I think it refers that the attribute parameterOrder it mustn't be present if empty.

Here is a possible patch:

diff --git a/ServiceDefinition/Dumper/WsdlDumper.php b/ServiceDefinition/Dumper/WsdlDumper.php
index 97517f7..51aa010 100644
--- a/ServiceDefinition/Dumper/WsdlDumper.php
+++ b/ServiceDefinition/Dumper/WsdlDumper.php
@@ -78,7 +78,9 @@ class WsdlDumper implements DumperInterface
                 $this->qualify($this->getRequestMessageName($method)),
                 $this->qualify($this->getResponseMessageName($method))
             );
-            $portOperation->setAttribute('parameterOrder', implode(' ', array_keys($requestParts)));
+            if (!empty($requestParts)) {
+                $portOperation->setAttribute('parameterOrder', implode(' ', array_keys($requestParts)));
+            }

             $baseBinding = array(
                 'use'           => 'literal',

Problem with PersistentCollection

Hey everyone,

I've encoutered another annoying little bug :

I've an entity with a Doctrine Association that I would like to appear in a webservice result. I'm using ComplexType to include the column in the object definition in the WSDL and that works perfectly. But when i try to retrieve the webservice result, it shows only empty tags.

Here's the Entity class :

<?php

namespace Acme\WebServicesBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;

/**
 * Acme\WebServicesBundle\Entity\Agenda
 *
 * @ORM\Table(name="agenda")
 * @ORM\Entity(repositoryClass="Acme\WebServicesBundle\Entity\AgendaRepository")
 */
class Agenda
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @Soap\ComplexType("int")
     */
    public $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255)
     * @Soap\ComplexType("string", nillable=true)
     */
    private $name;

    /**
     * @ORM\OneToMany(targetEntity="AgendaEvent", mappedBy="agenda", cascade={"all"})
     * @Soap\ComplexType("Acme\WebServicesBundle\Entity\AgendaEvent[]")
     */
    protected $agenda_events;

    public function __construct()
    {
        $this->agenda_events = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Add agenda_events
     *
     * @param Acme\WebServicesBundle\Entity\AgendaEven $agendaEvent
     */
    public function addAgendaEvent(\Acme\WebServicesBundle\Entity\AgendaEvent $agendaEvent)
    {
        $this->agenda_events[] = $agendaEvent;
    }

    /**
     * Get agenda_events
     *
     * @return Doctrine\Common\Collections\Collection
     */
    public function getAgendaEvents()
    {
        return $this->agenda_events;
    }
}

Here's the WSDL Extract :

<definitions name="AcmeApi" targetNamespace="http://acme.lxc/ws/AcmeApi/1.0/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://acme.lxc/ws/AcmeApi/1.0/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <portType name="AcmeApiPortType">
      <operation name="getAgenda" parameterOrder="id">
         <input message="tns:getAgendaRequest"/>
         <output message="tns:getAgendaResponse"/>
      </operation>
      ...
   </portType>
   <binding name="AcmeApiBinding" type="tns:AcmeApiPortType">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="getAgenda">
         <soap:operation soapAction="http://acme.lxc/ws/AcmeApi/1.0/getAgenda"/>
         <input>
            <soap:body parts="id" use="literal" namespace="http://acme.lxc/ws/AcmeApi/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </input>
         <output>
            <soap:body parts="return" use="literal" namespace="http://acme.lxc/ws/AcmeApi/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </output>
      </operation>
      ...
   </binding>
   <service name="AcmeApiService">
      <port name="AcmeApiPort" binding="tns:AcmeApiBinding">
         <soap:address location="http://acme.lxc/app_dev.php/ws/AcmeApi"/>
      </port>
   </service>
   <types>
      <xsd:schema targetNamespace="http://acme.lxc/ws/AcmeApi/1.0/">
         <xsd:complexType name="Acme.WebServicesBundle.Entity.AgendaEvent">
         ...
         </xsd:complexType>
         <xsd:complexType name="ArrayOfAcme.WebServicesBundle.Entity.AgendaEvent">
            <xsd:sequence>
               <xsd:element name="item" type="tns:Acme.WebServicesBundle.Entity.AgendaEvent" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="Acme.WebServicesBundle.Entity.Agenda">
            <xsd:all>
               <xsd:element name="id" type="xsd:int"/>
               <xsd:element name="name" type="xsd:string" nillable="true"/>
               <xsd:element name="agenda_events" type="tns:ArrayOfAcme.WebServicesBundle.Entity.AgendaEvent"/>
               ...
            </xsd:all>
         </xsd:complexType>
         ...
      </xsd:schema>
   </types>
   <message name="getAgendaRequest">
      <part name="id" type="xsd:int"/>
   </message>
   <message name="getAgendaResponse">
      <part name="return" type="tns:Acme.WebServicesBundle.Entity.Agenda"/>
   </message>
   ...
</definitions>

And here's the response :

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://acme.lxc/ws/AcmeApi/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <SOAP-ENV:Body>
      <ns1:getAgendaResponse>
         <return>
            <id>3</id>
            <name>Agenda</name>
            <agenda_events/>
         </return>
      </ns1:getAgendaResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Violation of encoding rules

Hi,

I just try to use your default simple example (hello) with a input name parameter.
I wanted to test the capability to validate or not the input parameter to throw a Soap exception when I need.
And when I put an xml node (like "< world />" without spaces...) instead of a simple string value (like "world") the Soap server cannot manage the request and I get this error : "Violation of encoding rules".

Can you catch this error and then throw a "bad request" Soap Fault instead of this default behaviour ?

Thx.
Wiser.

Issue with collection associations

Hello
Got strange issue today,

I have an entity "Category" and association "CategoryImage"
Category can have many CategoryImages

class Category {
    /**
     * @Soap\ComplexType("MyBundle\Entity\CategoryImage[]", nillable=true)
     * 
     * @var MyBundle\Entity\CategoryImage
     */
    private $images;
}

what is strange is first call returns correct result Category & CategoryImages but next calls return only Category with empty images. If I change wsdl url to app_dev.php I get correct result again (Category & images).
what can be a problem? The webservice itself returns correct object with images I checked it. The wsdl caching is off for client.
(WSDL_CACHE_NONE). The symfony app cache was cleared.

Alternative to MethodComplexType

According to documentation : http://besim.pl/SoapBundle/tutorial/complex_type.html#user-class

It's not possible anymore to define a Method as a Complex Type. Like I said in my comment (#5 (comment)), I was using MethodComplexType to convert objects list to ID arrays for easier communication through SOAP XML.

How should I do that ? Create new attributes (referenced by Soap/ComplexType) with corresponding getter/setter method ? That would be my first guess by I would rather be sure :)

Thanks in advance for your answer !

Hypolite

SoapFault throwing error

I would like my webservices to throw back a custom SoapFault when the logic fails, but I'm stuck with this error in the XML response :

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>ERR-001</faultcode>
<faultstring>Unable to find Agenda entity.</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Fatal error: Call to a member function setContent() on a non-object in /var/www/trunk/symfony/vendor/bundles/BeSimple/SoapBundle/Controller/SoapWebServiceController.php on line 61

This makes the client throw the "looks like we got no XML document" instead of the custom one.

Here's the code that throw the SoapFault :

<?php
    /**
     * @Soap\Method("getAgenda")
     * @Soap\Param("id", phpType = "int")
     * @Soap\Result(phpType = "\Acme\WebServicesBundle\Entity\Agenda")
     */
    public function getAgendaAction($id)
    {
        $em = $this->getDoctrine()->getEntityManager();

        $entity = $em->getRepository('AcmeWebServicesBundle:Agenda')->find($id);

        if (!$entity) {
            throw new \SoapFault('ERR-001', 'Unable to find Agenda entity.');
        }

        return new SoapResponse($entity);
    }
?>

Support for blob type?

I have to get an image stored in a BBDD using the webservice.
The image is stored in the BBDD in a "blob" field...is there any way to declare this field in the WSDL?

Thanks in advance,
Jordi

array like parameters not required?

Hi all, me again
I was implementing such method today

/**
     * 
     * @Soap\Method("setStatus")
     * @Soap\Param("status", phpType = "boolean")
     * @Soap\Param("id", phpType = "int[]")
     * @Soap\Result(phpType = "string")
     */
    public function setStatusAction($status, array $id)
    {
        $retArray = array(1, 2, 3);



        return $this->container->get('besimple.soap.response')->setReturnValue(print_r($id, true));
    }

If I don't pass $status is throws me an error about that parameter set as required, but for id[] parameter
it does not throw anything, it seems only applied to *[] like parameters, is this expected behaviour?
Thanks

define param ComplexType as array

Documentation says that it is possible to set complex type

/**
* @soap\Method("getUser")
* @soap\Param("name", phpType = "string")
* @soap\Result(phpType = "My\App\Entity\User")
*/

it works fine, but i want to define array of my complex type

 * @Soap\Result(phpType = "My\App\Entity\User[]")

is it possible?

Soap exceptions log

I can generate a log of errors by the BesimpleSoapBundle or I can trigger an event when an error occurs such as a field is void?

return xml without escape

Hello.

i set setReturnValue as xml string and get it escaped in response,
how can i avoid escaping?

and is it possible to change name of response body root tag from 'return' to 'result'?

Thanks for help.

SOAP Attachments

I see in this bundle some classes to handle attachments. Could you please give an example of how to use them?

Thanks.

Associative arrays

In order to pass or return associative arrays, do I need to use "ComplexType"? It would be great with an example of that too. Thanks.

WSDL_CACHE_DISK

[ErrorException]
Notice: Use of undefined constant WSDL_CACHE_DISK - assumed 'WSDL_CACHE_DISK' in /var/www/vhosts/pilot.com/jobs/data/build/05acbf/vendor/bundles/BeSimple/SoapBundle/DependencyInjection/BeSimpleSoapExtension.php line 161

I can not access the method $this->container->getDoctrine()

I can not access the method $this->container->getDoctrine()

namespace My\App\Controller;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;
use Symfony\Component\DependencyInjection\ContainerAware;

class DemoController extends ContainerAware
{
    /**
     * @Soap\Method("getUser")
     * @Soap\Param("name", phpType = "string")
     * @Soap\Result(phpType = "My\App\Entity\User")
     */
    public function getUserAction($name)
    {
        $user = $this->container->getDoctrine()->getRepository('MyApp:User')->findOneBy(array('name' => $name));

        if (!$user) {
            throw new \SoapFault('USER_NOT_FOUND', sprintf('The user with the name "%s" can not be found', $name));
        }

        return $this->container->get('besimple.soap.response')->setReturnValue($user);
    }
}

Support for date/time ?

Hello,

I was wondering how I could use Date Time type in WSDL, I didn't see anything like that in the bundle.

Thanks in advance,

Hypolite

Annotations PropertyComplexType and MethodComplexType seem not working

Hello,

I'm using BeSimpleSoapBundle for a week, but I just stumbled upon the ComplexType documentation today (http://besim.pl/SoapBundle).

Unfortunately, the Annotations described there don't seem to work as advertised. When I'm adding these annotations, the WSDL is not modified (all cache cleared) when I'm using "MethodComplexType" and I get the classic error "Cannot add a complex type Date that is not an object or where class could not be found in 'DefaultComplexType' strategy." when using PropertyComplexType on a Date property.

I tried to look for those annotations in the source code of the bundle but I didn't find anything. Are they implemented yet ? What should I do to manage ComplexType in the mean time ? Using SOAPized objects with public properties of standard type ?

Thanks in advance for your answer.

complex type error

when I define complex type as below
@Soap\Result(phpType = "\Acme\DemoBundle\Entity\Customer")

<error code="500" message="Internal Server Error">
    <exception class="ErrorException" message="Notice: Undefined index: Acme\DemoBundle\Entity\Customer in /var/www/Symfony2/Symfony/vendor/bundles/BeSimple/SoapBundle/ServiceBinding/RpcLiteralResponseMessageBinder.php line 80">

I get those errors, but the following works
@Soap\Result(phpType = "Acme\DemoBundle\Entity\Customer")

I think it should handle "" in the namespace?

configuration 'cache: none' fails

I set into the config.yml

be_simple_soap:
cache:
type: none

and get error:
[ErrorException]

Notice: Use of undefined constant WSDL_CACHE_NONE - assumed 'WSDL_CACHE_NONE'
in C:\wamp\www\tonic2\vendor\bundles\BeSimple\SoapBundle\DependencyInjection\BeS
impleSoapExtension.php line 158

Problem with PersistentCollection

Hey everyone,

I've encoutered another annoying little bug :

I've an entity with a Doctrine Association that I would like to appear in a webservice result. I'm using ComplexType to include the column in the object definition in the WSDL and that works perfectly. But when i try to retrieve the webservice result, it shows only empty tags.

Here's the Entity class :

<?php

namespace Acme\WebServicesBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

use BeSimple\SoapBundle\ServiceDefinition\Annotation as Soap;

/**
 * Acme\WebServicesBundle\Entity\Agenda
 *
 * @ORM\Table(name="agenda")
 * @ORM\Entity(repositoryClass="Acme\WebServicesBundle\Entity\AgendaRepository")
 */
class Agenda
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     * @Soap\ComplexType("int")
     */
    public $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255)
     * @Soap\ComplexType("string", nillable=true)
     */
    private $name;

    /**
     * @ORM\OneToMany(targetEntity="AgendaEvent", mappedBy="agenda", cascade={"all"})
     * @Soap\ComplexType("Acme\WebServicesBundle\Entity\AgendaEvent[]")
     */
    protected $agenda_events;

    public function __construct()
    {
        $this->agenda_events = new ArrayCollection();
    }

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Add agenda_events
     *
     * @param Acme\WebServicesBundle\Entity\AgendaEven $agendaEvent
     */
    public function addAgendaEvent(\Acme\WebServicesBundle\Entity\AgendaEvent $agendaEvent)
    {
        $this->agenda_events[] = $agendaEvent;
    }

    /**
     * Get agenda_events
     *
     * @return Doctrine\Common\Collections\Collection
     */
    public function getAgendaEvents()
    {
        return $this->agenda_events;
    }
}

Here's the WSDL Extract :

<definitions name="AcmeApi" targetNamespace="http://acme.lxc/ws/AcmeApi/1.0/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://acme.lxc/ws/AcmeApi/1.0/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <portType name="AcmeApiPortType">
      <operation name="getAgenda" parameterOrder="id">
         <input message="tns:getAgendaRequest"/>
         <output message="tns:getAgendaResponse"/>
      </operation>
      ...
   </portType>
   <binding name="AcmeApiBinding" type="tns:AcmeApiPortType">
      <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
      <operation name="getAgenda">
         <soap:operation soapAction="http://acme.lxc/ws/AcmeApi/1.0/getAgenda"/>
         <input>
            <soap:body parts="id" use="literal" namespace="http://acme.lxc/ws/AcmeApi/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </input>
         <output>
            <soap:body parts="return" use="literal" namespace="http://acme.lxc/ws/AcmeApi/1.0/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
         </output>
      </operation>
      ...
   </binding>
   <service name="AcmeApiService">
      <port name="AcmeApiPort" binding="tns:AcmeApiBinding">
         <soap:address location="http://acme.lxc/app_dev.php/ws/AcmeApi"/>
      </port>
   </service>
   <types>
      <xsd:schema targetNamespace="http://acme.lxc/ws/AcmeApi/1.0/">
         <xsd:complexType name="Acme.WebServicesBundle.Entity.AgendaEvent">
         ...
         </xsd:complexType>
         <xsd:complexType name="ArrayOfAcme.WebServicesBundle.Entity.AgendaEvent">
            <xsd:sequence>
               <xsd:element name="item" type="tns:Acme.WebServicesBundle.Entity.AgendaEvent" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
         </xsd:complexType>
         <xsd:complexType name="Acme.WebServicesBundle.Entity.Agenda">
            <xsd:all>
               <xsd:element name="id" type="xsd:int"/>
               <xsd:element name="name" type="xsd:string" nillable="true"/>
               <xsd:element name="agenda_events" type="tns:ArrayOfAcme.WebServicesBundle.Entity.AgendaEvent"/>
               ...
            </xsd:all>
         </xsd:complexType>
         ...
      </xsd:schema>
   </types>
   <message name="getAgendaRequest">
      <part name="id" type="xsd:int"/>
   </message>
   <message name="getAgendaResponse">
      <part name="return" type="tns:Acme.WebServicesBundle.Entity.Agenda"/>
   </message>
   ...
</definitions>

And here's the response :

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://acme.lxc/ws/AcmeApi/1.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <SOAP-ENV:Body>
      <ns1:getAgendaResponse>
         <return>
            <id>3</id>
            <name>Agenda</name>
            <agenda_events/>
         </return>
      </ns1:getAgendaResponse>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Cache and $definitionComplexTypes in RpcLiteralResponseMessageBinder

Hello,

I have an issue with empty $definitionComplexTypes in RpcLiteralResponseMessageBinder when it comes from cache.

As a consequence the complex type are not shown in responses.
It works one time (on first time) when cache is generating or any time when cache is disabled.

Thanks for you help,
Regards.

Some information about my definition.
The method is annotated as
* @soap\Method("getAgenda")
* @soap\Param("agenda_id", phpType = "int")
* @soap\Result(phpType = "Rolel\WebServicesBundle\Entity\Agenda")

The entity agenda contains a sub-entity slots:
* @Orm\OneToMany(targetEntity="AgendaSlot", mappedBy="agenda", cascade={"all"})
* @soap\ComplexType("Rolel\WebServicesBundle\Entity\AgendaSlot[]", nillable=true)
protected $agenda_slots;

This entities appears as empty in response.

Installation Documentation

In the installation docs, the following:

$loader->registerNamespaces(array(
    'BeSimple\\SoapCommon' => __DIR__.'/../vendor/besimple-soapcommon',
    'BeSimple\\SoapServer' => __DIR__.'/../vendor/besimple-soapserver',
    'BeSimple\\SoapClient' => __DIR__.'/../vendor/besimple-soapclient',
    // your other namespaces
));

needs to be:

$loader->registerNamespaces(array(
    'BeSimple\\SoapCommon' => __DIR__.'/../vendor/besimple-soapcommon/src',
    'BeSimple\\SoapServer' => __DIR__.'/../vendor/besimple-soapserver/src',
    'BeSimple\\SoapClient' => __DIR__.'/../vendor/besimple-soapclient/src',
    // your other namespaces
));

Notice the addition of "/src" on the paths.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.