RE: [PHP-SOAP-DEV] WSDLGenerator
Status: Alpha
Brought to you by:
rodif_bl
From: phpsurf <ph...@if...> - 2002-05-05 11:10:46
|
> -----Original Message----- > From: brad lafountain [mailto:rod...@ya...] > Sent: dimanche 5 mai 2002 07:24 > To: phpsurf > Cc: php...@li... > Subject: RE: [PHP-SOAP-DEV] WSDLGenerator > > > > --- phpsurf <ph...@if...> wrote: > > right, we are talking about several things here ! :) > > > > 1- wsdl auto-generation: > > ok, good idea, I have no other experience of this (only played with java > > implementation which is type specific ...) > > Yeah this topic is going to be hard. Im going to try and > implements something > here. Its not going to be as good as the java stuff becuase of > the type stuff. > but maybe it can adventuall be useful. > > Im not sure if you know this but you can currently bind your service to a > existing wsdl. > <? > $server = new SoapServer(...); > $server->bind("some_wsdl.wsdl"); > $server->handle(); > ?> > > This does a little magic. If your wsdl defines types in the schema part. > php-saop will try and "convert" the type automatically according > to the type in > the wsdl. > > Say the wsdl defines > <message name="getShort"> > <part name="Result" type="xsd:short" /> > </message> > > and the php function > > function getShort() > { > return "123"; > } > > php-soap would return the message with the xsd:short type not the > xsd:string. > again this is only done when binding to a wsdl. > > This also works with complex types. > <complexType name="someType"> > <all> > <element name="short" type="xsd:short" /> > <element name="string" type="xsd:string" /> > </all> > </complexType> > > <message name="getType"> > <part name="Result" type="someType" /> > </message> > > function getType() > { > $ret->string = "some string"; > $ret->short = "123"; > $ret->double 1.3; > return $ret; > } > > php-soap will return the type as someType and add string as xsd:string and > short as xsd:short but leave out the double. > > I think this is pretty flexable and powerfull, but this > functionality is still > pretty experimental. I need to get how that works documented. > That also works > on the client side. > > $soap = new SoapObject("somewsdl.wsdl"); > $soap->echoShort("1234"); Right, this is already a pretty good job ! What I meant is just the ability to override this default serialization process with some custom handler. This is specially usefull in complex services when you want to work with some kind of beans ... because you can add some controls, or actions like countings or locking, or adding framework-level parameters like for security or debug ... when passing your objects to the soap service. I've been working on a quite big project using apache soap and this kind of stuff has been very very useful because it let us implement a complex framework above the apache soap to do all the technical stuff, and then developers only had to deal with the business aspect of the service ... > > > What i did just add today is the abilty to do this. > http://server.com/some_php_service.php?WSDL (.net style) > and if there is a wsdl bound to that service it will output the wsdl. > don't seen it yet ... gonna have a look > > > > 2- php/soap serialization/deserialization: > > indeed wsdl defines the soap type of a soap parameter, but my > point here is: > > how to determine the corresponding php type ? > > As they do in the Apache java implementation of soap, we could have a > > mapping table that would associate each soap type with a php > type ... and we > > could also be able to define our own serializer/deserializer > function ... > > something that would tell php_soap (for a specific instance of > soap server): > > "every time you receive a soap type 'mySchemaSoapType' (as > defined is the > > schema part of the wsdl), deserialize it into the following php type > > 'myPhpClass' (which would be an existing class, or any php type code), > > using the deserializer handler > 'mySoapToPhpDeserializerFunction' (wich is an > > existing function)" > > > > this definition could run-time on client side and setup (a specific xml > > document/ or comments in the code) on server side > > or simply run-time on both client and server side ... > > for example, one can define a bean_serializer which will only > send via soap > > attributes of an object that have a getter method ... > > > > maybe you could have a look at the Apache Implementation of > Soap in Java to > > see how they handled this problematic ... > > I think their aproach is very attractive because it really let > the developer > > do what he wants with the soap implementation ... this is very > powerfull ! > > http://xml.apache.org/soap/index.html > > If the above small sample made any sence. the php-to-xml can be > handled by > using wsdls but the xml-to-php only seralizes to stdobjects and > standard php > types. this is where I suggested a mapping table (eg: the soap mapping registry in apache soap) to define the right php class for a specific xsd type. > A api would be pretty nice for this functionality. I do > use apache soap > i haven't go into the custom seriazlation. > I did mostly use bean serialization and complex types with several actions in the getter/setter methods. this could be really good stuff to have this :) maybe you can even find something better than apache did ... > - Brad > ______________________________________________________________________________ ifrance.com, l'email gratuit le plus complet de l'Internet ! vos emails depuis un navigateur, en POP3, sur Minitel, sur le WAP... http://www.ifrance.com/_reloc/email.emailif |