Quantcast

Recursion issue with Zend_Soap_AutoDiscovery.

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Recursion issue with Zend_Soap_AutoDiscovery.

Richard Quadling
Hi.

I'm in the process of building a web service which incorporates the
ability for the server to inform the client that a particular call has
been superseded by another.

So, cut down (I've removed all the other details), ...

class ServiceDetails
        {
        /**
         * Superseded by
         *
         * Details of the replacement service that is now available.
         *
         * @var ServiceDetails
         */
        public $SupersededBy = Null;
        }

When I try to use Zend_Soap_AutoDiscover() against this class, I get ...

"Infinite recursion, cannot nest 'ServiceDetails' into itsself." (sic)

There has to be recursion, as there could be many levels of
supersedence, each one providing the details of their own replacement.

The call to return the service details read the requested
services/class constants. If there is a superseded entry, it creates a
new request for service details on the new class (the recursion).

If the value is Null, then there is no recursion.



I'm using ...

new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');

as the strategy as the service has arrays of complex types in the output.



If I use @var string and then manually replace the type in the WSDL
file from ...

          <xsd:element name="SupersededBy" type="xsd:string" />

to

          <xsd:element name="SupersededBy" type="tns:ServiceDetails" />

and use wsdl2php against this, it all _SEEMS_ to work OK.

So. Is this my best option? Or is there a way to do this that I'm missing?


Any ideas really.


Is this even a bug in the Zend_Soap_AutoDiscover class?



Regards,

Richard Quadling.




--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion issue with Zend_Soap_AutoDiscovery.

Richard Quadling
2010/1/25 Nathan Rixham <[hidden email]>:

> Richard Quadling wrote:
>> Hi.
>>
>> I'm in the process of building a web service which incorporates the
>> ability for the server to inform the client that a particular call has
>> been superseded by another.
>>
>> So, cut down (I've removed all the other details), ...
>>
>> class ServiceDetails
>>       {
>>       /**
>>        * Superseded by
>>        *
>>        * Details of the replacement service that is now available.
>>        *
>>        * @var ServiceDetails
>>        */
>>       public $SupersededBy = Null;
>>       }
>>
>> When I try to use Zend_Soap_AutoDiscover() against this class, I get ...
>>
>> "Infinite recursion, cannot nest 'ServiceDetails' into itsself." (sic)
>>
>> There has to be recursion, as there could be many levels of
>> supersedence, each one providing the details of their own replacement.
>>
>> The call to return the service details read the requested
>> services/class constants. If there is a superseded entry, it creates a
>> new request for service details on the new class (the recursion).
>>
>> If the value is Null, then there is no recursion.
>>
>>
>>
>> I'm using ...
>>
>> new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
>>
>> as the strategy as the service has arrays of complex types in the output.
>>
>>
>>
>> If I use @var string and then manually replace the type in the WSDL
>> file from ...
>>
>>           <xsd:element name="SupersededBy" type="xsd:string" />
>>
>> to
>>
>>           <xsd:element name="SupersededBy" type="tns:ServiceDetails" />
>>
>> and use wsdl2php against this, it all _SEEMS_ to work OK.
>>
>> So. Is this my best option? Or is there a way to do this that I'm missing?
>>
>>
>> Any ideas really.
>>
>
> http://wso2.org/projects/wsf/php ;)
>
> helpful eh
>

Not yet! I'm on windows and I'm not confident enough to put extensions
I've built out on the live servers.

Also, it is using VC8 and I'm on 5.3 (VC9, x86, nts). So not tested.



--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion issue with Zend_Soap_AutoDiscovery.

Richard Quadling
In reply to this post by Richard Quadling
2010/1/25 Richard Quadling <[hidden email]>:

> Hi.
>
> I'm in the process of building a web service which incorporates the
> ability for the server to inform the client that a particular call has
> been superseded by another.
>
> So, cut down (I've removed all the other details), ...
>
> class ServiceDetails
>        {
>        /**
>         * Superseded by
>         *
>         * Details of the replacement service that is now available.
>         *
>         * @var ServiceDetails
>         */
>        public $SupersededBy = Null;
>        }
>
> When I try to use Zend_Soap_AutoDiscover() against this class, I get ...
>
> "Infinite recursion, cannot nest 'ServiceDetails' into itsself." (sic)
>
> There has to be recursion, as there could be many levels of
> supersedence, each one providing the details of their own replacement.
>
> The call to return the service details read the requested
> services/class constants. If there is a superseded entry, it creates a
> new request for service details on the new class (the recursion).
>
> If the value is Null, then there is no recursion.
>
>
>
> I'm using ...
>
> new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
>
> as the strategy as the service has arrays of complex types in the output.
>
>
>
> If I use @var string and then manually replace the type in the WSDL
> file from ...
>
>          <xsd:element name="SupersededBy" type="xsd:string" />
>
> to
>
>          <xsd:element name="SupersededBy" type="tns:ServiceDetails" />
>
> and use wsdl2php against this, it all _SEEMS_ to work OK.
>
> So. Is this my best option? Or is there a way to do this that I'm missing?
>
>
> Any ideas really.
>
>
> Is this even a bug in the Zend_Soap_AutoDiscover class?
>
>
>
> Regards,
>
> Richard Quadling.
>
>
>
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

I amended Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex::addComplexType().

Changing the (sic) ...

throw new Zend_Soap_Wsdl_Exception("Infinite recursion, cannot nest
'".$type."' into itsself.");

to ...

return "tns:$type";

and all is working just fine.

Obviously, I may be breaking something here, but I've not come across
it yet. Early days .... !

--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion issue with Zend_Soap_AutoDiscovery.

weierophinney
Administrator
-- Richard Quadling <[hidden email]> wrote
(on Wednesday, 27 January 2010, 10:03 AM +0000):

> 2010/1/25 Richard Quadling <[hidden email]>:
> > I'm in the process of building a web service which incorporates the
> > ability for the server to inform the client that a particular call has
> > been superseded by another.
> >
> > So, cut down (I've removed all the other details), ...
> >
> > class ServiceDetails
> >        {
> >        /**
> >         * Superseded by
> >         *
> >         * Details of the replacement service that is now available.
> >         *
> >         * @var ServiceDetails
> >         */
> >        public $SupersededBy = Null;
> >        }
> >
> > When I try to use Zend_Soap_AutoDiscover() against this class, I get ...
> >
> > "Infinite recursion, cannot nest 'ServiceDetails' into itsself." (sic)
> >
> > There has to be recursion, as there could be many levels of
> > supersedence, each one providing the details of their own replacement.
> >
> > The call to return the service details read the requested
> > services/class constants. If there is a superseded entry, it creates a
> > new request for service details on the new class (the recursion).
> >
> > If the value is Null, then there is no recursion.
> >
> >
> >
> > I'm using ...
> >
> > new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
> >
> > as the strategy as the service has arrays of complex types in the output.
> >
> >
> >
> > If I use @var string and then manually replace the type in the WSDL
> > file from ...
> >
> >          <xsd:element name="SupersededBy" type="xsd:string" />
> >
> > to
> >
> >          <xsd:element name="SupersededBy" type="tns:ServiceDetails" />
> >
> > and use wsdl2php against this, it all _SEEMS_ to work OK.
> >
> > So. Is this my best option? Or is there a way to do this that I'm missing?
> >
> >
> > Any ideas really.
> >
> >
> > Is this even a bug in the Zend_Soap_AutoDiscover class?
>
> I amended Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex::addComplexType().
>
> Changing the (sic) ...
>
> throw new Zend_Soap_Wsdl_Exception("Infinite recursion, cannot nest
> '".$type."' into itsself.");
>
> to ...
>
> return "tns:$type";
>
> and all is working just fine.
>
> Obviously, I may be breaking something here, but I've not come across
> it yet. Early days .... !

Can you open an issue in the tracker and provide a test case and your
patch? This does sound like a bug, and from what you've described, I
think you hit on the appropriate solution.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion issue with Zend_Soap_AutoDiscovery.

Richard Quadling
2010/1/27 Matthew Weier O'Phinney <[hidden email]>:

> -- Richard Quadling <[hidden email]> wrote
> (on Wednesday, 27 January 2010, 10:03 AM +0000):
>> 2010/1/25 Richard Quadling <[hidden email]>:
>> > I'm in the process of building a web service which incorporates the
>> > ability for the server to inform the client that a particular call has
>> > been superseded by another.
>> >
>> > So, cut down (I've removed all the other details), ...
>> >
>> > class ServiceDetails
>> >        {
>> >        /**
>> >         * Superseded by
>> >         *
>> >         * Details of the replacement service that is now available.
>> >         *
>> >         * @var ServiceDetails
>> >         */
>> >        public $SupersededBy = Null;
>> >        }
>> >
>> > When I try to use Zend_Soap_AutoDiscover() against this class, I get ...
>> >
>> > "Infinite recursion, cannot nest 'ServiceDetails' into itsself." (sic)
>> >
>> > There has to be recursion, as there could be many levels of
>> > supersedence, each one providing the details of their own replacement.
>> >
>> > The call to return the service details read the requested
>> > services/class constants. If there is a superseded entry, it creates a
>> > new request for service details on the new class (the recursion).
>> >
>> > If the value is Null, then there is no recursion.
>> >
>> >
>> >
>> > I'm using ...
>> >
>> > new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
>> >
>> > as the strategy as the service has arrays of complex types in the output.
>> >
>> >
>> >
>> > If I use @var string and then manually replace the type in the WSDL
>> > file from ...
>> >
>> >          <xsd:element name="SupersededBy" type="xsd:string" />
>> >
>> > to
>> >
>> >          <xsd:element name="SupersededBy" type="tns:ServiceDetails" />
>> >
>> > and use wsdl2php against this, it all _SEEMS_ to work OK.
>> >
>> > So. Is this my best option? Or is there a way to do this that I'm missing?
>> >
>> >
>> > Any ideas really.
>> >
>> >
>> > Is this even a bug in the Zend_Soap_AutoDiscover class?
>>
>> I amended Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex::addComplexType().
>>
>> Changing the (sic) ...
>>
>> throw new Zend_Soap_Wsdl_Exception("Infinite recursion, cannot nest
>> '".$type."' into itsself.");
>>
>> to ...
>>
>> return "tns:$type";
>>
>> and all is working just fine.
>>
>> Obviously, I may be breaking something here, but I've not come across
>> it yet. Early days .... !
>
> Can you open an issue in the tracker and provide a test case and your
> patch? This does sound like a bug, and from what you've described, I
> think you hit on the appropriate solution.
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [hidden email]
> Zend Framework          | http://framework.zend.com/
> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>

OK.

I think there is more to do though as I suspect if you have type a
contains type b contains type a then you will need to know what types
have already been added.

Probably does that already.

Will see if I can make a sensible test.

Currently, an exception is thrown saying that this is not allowed. So
really it is an enhancement.

Oh. There is a "bug". A typo. "itsself" is in exception rather than "itself".

I'll report this as an enhancement.

--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion issue with Zend_Soap_AutoDiscovery.

Richard Quadling
2010/1/27 Richard Quadling <[hidden email]>:

> 2010/1/27 Matthew Weier O'Phinney <[hidden email]>:
>> -- Richard Quadling <[hidden email]> wrote
>> (on Wednesday, 27 January 2010, 10:03 AM +0000):
>>> 2010/1/25 Richard Quadling <[hidden email]>:
>>> > I'm in the process of building a web service which incorporates the
>>> > ability for the server to inform the client that a particular call has
>>> > been superseded by another.
>>> >
>>> > So, cut down (I've removed all the other details), ...
>>> >
>>> > class ServiceDetails
>>> >        {
>>> >        /**
>>> >         * Superseded by
>>> >         *
>>> >         * Details of the replacement service that is now available.
>>> >         *
>>> >         * @var ServiceDetails
>>> >         */
>>> >        public $SupersededBy = Null;
>>> >        }
>>> >
>>> > When I try to use Zend_Soap_AutoDiscover() against this class, I get ...
>>> >
>>> > "Infinite recursion, cannot nest 'ServiceDetails' into itsself." (sic)
>>> >
>>> > There has to be recursion, as there could be many levels of
>>> > supersedence, each one providing the details of their own replacement.
>>> >
>>> > The call to return the service details read the requested
>>> > services/class constants. If there is a superseded entry, it creates a
>>> > new request for service details on the new class (the recursion).
>>> >
>>> > If the value is Null, then there is no recursion.
>>> >
>>> >
>>> >
>>> > I'm using ...
>>> >
>>> > new Zend_Soap_AutoDiscover('Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex');
>>> >
>>> > as the strategy as the service has arrays of complex types in the output.
>>> >
>>> >
>>> >
>>> > If I use @var string and then manually replace the type in the WSDL
>>> > file from ...
>>> >
>>> >          <xsd:element name="SupersededBy" type="xsd:string" />
>>> >
>>> > to
>>> >
>>> >          <xsd:element name="SupersededBy" type="tns:ServiceDetails" />
>>> >
>>> > and use wsdl2php against this, it all _SEEMS_ to work OK.
>>> >
>>> > So. Is this my best option? Or is there a way to do this that I'm missing?
>>> >
>>> >
>>> > Any ideas really.
>>> >
>>> >
>>> > Is this even a bug in the Zend_Soap_AutoDiscover class?
>>>
>>> I amended Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex::addComplexType().
>>>
>>> Changing the (sic) ...
>>>
>>> throw new Zend_Soap_Wsdl_Exception("Infinite recursion, cannot nest
>>> '".$type."' into itsself.");
>>>
>>> to ...
>>>
>>> return "tns:$type";
>>>
>>> and all is working just fine.
>>>
>>> Obviously, I may be breaking something here, but I've not come across
>>> it yet. Early days .... !
>>
>> Can you open an issue in the tracker and provide a test case and your
>> patch? This does sound like a bug, and from what you've described, I
>> think you hit on the appropriate solution.
>>
>> --
>> Matthew Weier O'Phinney
>> Project Lead            | [hidden email]
>> Zend Framework          | http://framework.zend.com/
>> PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
>>
>
> OK.
>
> I think there is more to do though as I suspect if you have type a
> contains type b contains type a then you will need to know what types
> have already been added.
>
> Probably does that already.
>
> Will see if I can make a sensible test.
>
> Currently, an exception is thrown saying that this is not allowed. So
> really it is an enhancement.
>
> Oh. There is a "bug". A typo. "itsself" is in exception rather than "itself".
>
> I'll report this as an enhancement.
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
> Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>

Typo : http://framework.zend.com/issues/browse/ZF-8949
and
Recursion : http://framework.zend.com/issues/browse/ZF-8948

I'm not convinced that the recursion fix is 100% as ...

class SingleEntity{
        /** @var SingleEntity[] */
        public $Entities = array();

        /** @return SingleEntity */
        public function SingleEntity(){
                return new SingleEntity();
        }
}

produces types of ...

<xsd:complexType name="ArrayOfSingleEntity">
 <xsd:complexContent>
  <xsd:restriction base="soap-enc:Array">
   <xsd:attribute ref="soap-enc:arrayType"
wsdl:arrayType="tns:SingleEntity[]" />
  </xsd:restriction>
 </xsd:complexContent>
</xsd:complexType>

<xsd:complexType name="SingleEntity">
 <xsd:all>
  <xsd:element name="Entities" type="tns:SingleEntity[]" />
 </xsd:all>
</xsd:complexType>

<xsd:complexType name="SingleEntity">
 <xsd:all>
  <xsd:element name="Entities" type="tns:ArrayOfSingleEntity" />
 </xsd:all>
</xsd:complexType>

and I've no idea if that is valid.

I'm new with this, so please check this.

Thank you.
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Recursion issue with Zend_Soap_AutoDiscovery.

weierophinney
Administrator
-- Richard Quadling <[hidden email]> wrote
(on Wednesday, 27 January 2010, 01:47 PM +0000):

<snip>

> Typo : http://framework.zend.com/issues/browse/ZF-8949
> and
> Recursion : http://framework.zend.com/issues/browse/ZF-8948
>
> I'm not convinced that the recursion fix is 100% as ...

No worries -- add the below information to the ticket as well. I think
your fix is in the right direction, but, as you note, may need a more
sophisticated treatment.

Thanks for filing the tickets!

> class SingleEntity{
> /** @var SingleEntity[] */
> public $Entities = array();
>
> /** @return SingleEntity */
> public function SingleEntity(){
> return new SingleEntity();
> }
> }
>
> produces types of ...
>
> <xsd:complexType name="ArrayOfSingleEntity">
>  <xsd:complexContent>
>   <xsd:restriction base="soap-enc:Array">
>    <xsd:attribute ref="soap-enc:arrayType"
> wsdl:arrayType="tns:SingleEntity[]" />
>   </xsd:restriction>
>  </xsd:complexContent>
> </xsd:complexType>
>
> <xsd:complexType name="SingleEntity">
>  <xsd:all>
>   <xsd:element name="Entities" type="tns:SingleEntity[]" />
>  </xsd:all>
> </xsd:complexType>
>
> <xsd:complexType name="SingleEntity">
>  <xsd:all>
>   <xsd:element name="Entities" type="tns:ArrayOfSingleEntity" />
>  </xsd:all>
> </xsd:complexType>
>
> and I've no idea if that is valid.
>
> I'm new with this, so please check this.

--
Matthew Weier O'Phinney
Project Lead            | [hidden email]
Zend Framework          | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
Loading...