[phpsoa] Re: WSDL and "extends"

2008-01-02 Thread Graham Charters

Hi,

What you're seeing is a consequence of the php internals design, in
that a derived class is not processed at compile-time.  I encountered
this when adding the ability to control service methods through an
interface.  You can get round the problem by moving the include for
SCA.php to after the definition of the derived class (I think this
should be the recommended practice, and needs updating in the docs).
The following works for me:

ParentClass.php



DerivedClass.php



I hope this helps.

Graham.

On 2 Jan, 17:46, aouriques <[EMAIL PROTECTED]> wrote:
> First of all, thank you Graham.
>
> I have tested your example and it works fine, but I am trying to
> create another structure where I have a parent class in a separated
> file.
> For example:
>  include_once 'SCA/SCA.php';
>
> /**
>  * My service using extension
>  *
>  * @service
>  * @binding.soap
>  */
> class ParentClass {
>
> public function method1() {}
>
> }
>
> ?>
>
>  include_once 'ParentClass.php';
> include_once 'SCA/SCA.php';
>
> /**
>  * My service using extension
>  *
>  * @service
>  * @binding.soap
>  */
> class DerivedClass extends ParentClass {
>
> public function method2() {}
>
> }
>
> ?>
>
> Using this files structure it doesn't work.
>
> Thank you.
>
> On 2 Jan, 14:18, Graham Charters <[EMAIL PROTECTED]> wrote:> OK, so I should 
> have tried it before responding
>
> > Get_class_methods does include methods from parent classes.  I've just
> > tried the following example:
>
> > filename: DerivedClass.php
>
> > 
> > include 'SCA/SCA.php';
>
> > class ParentClass {
>
> > public function method1() {}
>
> > }
>
> > /**
> >  * My service using extension
> >  *
> >  * @service
> >  * @binding.soap
> >  */
> > class DerivedClass extends ParentClass {
>
> > public function method2() {}
>
> > }
>
> > ?>
>
> > When I point my browser athttp://./DerivedClass.php?wsdl, it
> > returns the following, which includes both methods.
>
> > 
> > http://DerivedClass"; xmlns:wsdl="http://
> > schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/
> > soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> > targetNamespace="http://DerivedClass";>
> >   
> > http://www.w3.org/2001/XMLSchema";
> >   targetNamespace="http://DerivedClass";
> >   elementFormDefault="qualified">
> >   
> > 
> >   
> >   
> > 
> >   
>
> >   
> > 
> >   
> >   
> > 
> >   
> >   
> > 
> >   
>
> >   
> > 
> >   
> >   
> > 
> >   
> >   
> > 
> >   
>
> > 
> >   
>
> >   
> > 
> >   
> >   
> > 
> >   
>
> >   
> > 
> >   
> >   
> > 
> >   
> >   
> > 
> >   
>
> >   
> > 
> > 
> >   
> >   
> > 
> >   
> >> type="tns2:DerivedClassPortType">
> > http://schemas.xmlsoap.org/soap/http";
> > style="document"/>
>
> > 
> >   
> >   
> > 
> >   
> >   
> > 
> >   
> > 
>
> > 
> >   
> >   
> > 
> >   
> >   
> > 
> >   
> > 
>
> >   
> >   
> >  > binding="tns2:DerivedClassBinding">
> >   http://localhost/bugs/extends/
> > DerivedClass.php"/>
> > 
> >   
> > 
>
> > 
>
> > Can you give this example a try and see what happens?
>
> > Regards,
>
> > Graham.
>
> > On 2 Jan, 17:07, Graham Charters <[EMAIL PROTECTED]> wrote:
>
> > > Hi,
>
> > > Sorry for not getting back to you sooner.  Extends is not something
> > > I'm aware of being supported.  The SCA_AnnotationReader uses
> > > get_class_methods to return the methods which the class may expose
> > > (depends on whether they're public or are restricted using an
> > > interface).  I haven't tried it yet, but my guess is this doesn't
> > > return methods defined by the parent class.  If this is the case, then
> > > this code would need updating to include parent classes when
> > > determining the candidate methods to be exposed.
>
> > > I hope this helps.
>
> > > Graham.
>
> > > On 21 Dec 2007, 15:24, aouriques <[EMAIL PROTECTED]> wrote:
>
> > > > Hello,
>
> > > > I would like to know how can I use the "extends" for services.
> > > > I have a Customer service that extends the User service.
>
> > > > /**
> > > > 
> > > >  * @service
> > > >  * @binding.soap
> > > >  * @locationhttp://mydomain.com/SOA/Customer.php
> > > > */
> > > > class Customer extends User {
> > > > ...
>
> > > > }
>
> > > > What should I add into the comments or what should I to do when using
> > > > an extension?
> > > > When I use the Customer alone it works fine, but when I use the
> > > > Customer with the extension the WSDL is not generated.
>
> > > > Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe fro

[phpsoa] Re: WSDL and "extends"

2008-01-02 Thread aouriques

First of all, thank you Graham.

I have tested your example and it works fine, but I am trying to
create another structure where I have a parent class in a separated
file.
For example:




Using this files structure it doesn't work.

Thank you.

On 2 Jan, 14:18, Graham Charters <[EMAIL PROTECTED]> wrote:
> OK, so I should have tried it before responding
>
> Get_class_methods does include methods from parent classes.  I've just
> tried the following example:
>
> filename: DerivedClass.php
>
> 
> include 'SCA/SCA.php';
>
> class ParentClass {
>
> public function method1() {}
>
> }
>
> /**
>  * My service using extension
>  *
>  * @service
>  * @binding.soap
>  */
> class DerivedClass extends ParentClass {
>
> public function method2() {}
>
> }
>
> ?>
>
> When I point my browser athttp://./DerivedClass.php?wsdl, it
> returns the following, which includes both methods.
>
> 
> http://DerivedClass"; xmlns:wsdl="http://
> schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/
> soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> targetNamespace="http://DerivedClass";>
>   
> http://www.w3.org/2001/XMLSchema";
>   targetNamespace="http://DerivedClass";
>   elementFormDefault="qualified">
>   
> 
>   
>   
> 
>   
>
>   
> 
>   
>   
> 
>   
>   
> 
>   
>
>   
> 
>   
>   
> 
>   
>   
> 
>   
>
> 
>   
>
>   
> 
>   
>   
> 
>   
>
>   
> 
>   
>   
> 
>   
>   
> 
>   
>
>   
> 
> 
>   
>   
> 
>   
>type="tns2:DerivedClassPortType">
> http://schemas.xmlsoap.org/soap/http";
> style="document"/>
>
> 
>   
>   
> 
>   
>   
> 
>   
> 
>
> 
>   
>   
> 
>   
>   
> 
>   
> 
>
>   
>   
>  binding="tns2:DerivedClassBinding">
>   http://localhost/bugs/extends/
> DerivedClass.php"/>
> 
>   
> 
>
> 
>
> Can you give this example a try and see what happens?
>
> Regards,
>
> Graham.
>
> On 2 Jan, 17:07, Graham Charters <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > Sorry for not getting back to you sooner.  Extends is not something
> > I'm aware of being supported.  The SCA_AnnotationReader uses
> > get_class_methods to return the methods which the class may expose
> > (depends on whether they're public or are restricted using an
> > interface).  I haven't tried it yet, but my guess is this doesn't
> > return methods defined by the parent class.  If this is the case, then
> > this code would need updating to include parent classes when
> > determining the candidate methods to be exposed.
>
> > I hope this helps.
>
> > Graham.
>
> > On 21 Dec 2007, 15:24, aouriques <[EMAIL PROTECTED]> wrote:
>
> > > Hello,
>
> > > I would like to know how can I use the "extends" for services.
> > > I have a Customer service that extends the User service.
>
> > > /**
> > > 
> > >  * @service
> > >  * @binding.soap
> > >  * @locationhttp://mydomain.com/SOA/Customer.php
> > > */
> > > class Customer extends User {
> > > ...
>
> > > }
>
> > > What should I add into the comments or what should I to do when using
> > > an extension?
> > > When I use the Customer alone it works fine, but when I use the
> > > Customer with the extension the WSDL is not generated.
>
> > > Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] Re: WSDL and "extends"

2008-01-02 Thread Graham Charters

OK, so I should have tried it before responding

Get_class_methods does include methods from parent classes.  I've just
tried the following example:

filename: DerivedClass.php



When I point my browser at http://./DerivedClass.php?wsdl, it
returns the following, which includes both methods.


http://DerivedClass"; xmlns:wsdl="http://
schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/
soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
targetNamespace="http://DerivedClass";>
  
http://www.w3.org/2001/XMLSchema";
  targetNamespace="http://DerivedClass";
  elementFormDefault="qualified">
  

  
  

  

  

  
  

  
  

  

  

  
  

  
  

  


  

  

  
  

  

  

  
  

  
  

  

  


  
  

  
  
http://schemas.xmlsoap.org/soap/http";
style="document"/>


  
  

  
  

  



  
  

  
  

  


  
  

  http://localhost/bugs/extends/
DerivedClass.php"/>

  




Can you give this example a try and see what happens?

Regards,

Graham.

On 2 Jan, 17:07, Graham Charters <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Sorry for not getting back to you sooner.  Extends is not something
> I'm aware of being supported.  The SCA_AnnotationReader uses
> get_class_methods to return the methods which the class may expose
> (depends on whether they're public or are restricted using an
> interface).  I haven't tried it yet, but my guess is this doesn't
> return methods defined by the parent class.  If this is the case, then
> this code would need updating to include parent classes when
> determining the candidate methods to be exposed.
>
> I hope this helps.
>
> Graham.
>
> On 21 Dec 2007, 15:24, aouriques <[EMAIL PROTECTED]> wrote:
>
> > Hello,
>
> > I would like to know how can I use the "extends" for services.
> > I have a Customer service that extends the User service.
>
> > /**
> > 
> >  * @service
> >  * @binding.soap
> >  * @locationhttp://mydomain.com/SOA/Customer.php
> > */
> > class Customer extends User {
> > ...
>
> > }
>
> > What should I add into the comments or what should I to do when using
> > an extension?
> > When I use the Customer alone it works fine, but when I use the
> > Customer with the extension the WSDL is not generated.
>
> > Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---



[phpsoa] Re: WSDL and "extends"

2008-01-02 Thread Graham Charters

Hi,

Sorry for not getting back to you sooner.  Extends is not something
I'm aware of being supported.  The SCA_AnnotationReader uses
get_class_methods to return the methods which the class may expose
(depends on whether they're public or are restricted using an
interface).  I haven't tried it yet, but my guess is this doesn't
return methods defined by the parent class.  If this is the case, then
this code would need updating to include parent classes when
determining the candidate methods to be exposed.

I hope this helps.

Graham.

On 21 Dec 2007, 15:24, aouriques <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I would like to know how can I use the "extends" for services.
> I have a Customer service that extends the User service.
>
> /**
> 
>  * @service
>  * @binding.soap
>  * @locationhttp://mydomain.com/SOA/Customer.php
> */
> class Customer extends User {
> ...
>
> }
>
> What should I add into the comments or what should I to do when using
> an extension?
> When I use the Customer alone it works fine, but when I use the
> Customer with the extension the WSDL is not generated.
>
> Thank you!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"phpsoa" group.
To post to this group, send email to phpsoa@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.co.uk/group/phpsoa?hl=en
-~--~~~~--~~--~--~---