Richard Quadling wrote: > On 16 February 2010 16:41, Nathan Rixham <nrixham@xxxxxxxxx> wrote: >> Nathan Rixham wrote: >>> Richard Quadling wrote: >>>> Hi. >>>> >>>> I want to docblock a set of properties to be xml primitive datatypes [1]. >>>> >>>> Considering that this is the correct type for the XML/SOAP/WSDL >>>> communication, how do I "bypass" Zend_WSDL / Zend_AutoDiscovery so >>>> that these types go through cleanly. I know that as far as PHP is >>>> concerned, the type is loose and it will be my responsibility to >>>> encode the values accordingly. It is in the WSDL generation, and hence >>>> the docblocks, that I want these types to be valid. >>>> >>>> I think I can achieve this by the following steps. >>>> >>>> 1 - Create a new concrete class from the >>>> Zend_Soap_Wsdl_Strategy_Abstract abstract class, say >>>> Zend_Soap_Wsdl_Strategy_W3C (as the type are defined by W3C). >>>> 2 - Implement the addComplexType() method to validate the type against >>>> the list and return it if is OK. >>>> >>>> What I am stuck on is how do I cascade from the new class so that I >>>> can still drop back to the Zend_Soap_Wsdl_Strategy_ArrayOfTypeComplex. >>>> >>>> I think the Zend_Soap_Wsdl_Strategy_Composite is of use here, but I >>>> can't quite work out how to use it. >>>> >>>> Any ideas would be appreciated. >>>> >>>> Regards, >>>> >>>> Richard Quadling. >>>> >>>> [1] http://www.w3.org/TR/xmlschema11-2/#built-in-primitive-datatypes >>>> >>> AFAIK the Zend Soap WSDL accessor already maps up php types to xsd >>> types; a PHP String maps to an xsd:string, integer to xsd:int and so forth. >>> >>> XML schema 1.1 datatypes are pretty much the same as; and backwards >>> compatible with the current xml schema datatypes (which are still the >>> recommended standard, as 1.1 isn't a recommendation yet, work in >>> progress) and use the same namespace. Thus the existing implementation >>> should be xml w3c complaint both now and in the future. >>> >>> All that's said purely based on the zend docs [1] and not through >>> practically using Zend_Soap_Wsdl_* though! >> >> sigh.. [1] = http://framework.zend.com/manual/en/zend.soap.wsdl.html >> (specifically Type mapping) - might make more sense now! >> >> >> > > I think you've missed the point. totally! > I want to tell the outside world, via the WSDL, that property X is an > xsd:datetime (hmm ok, for that to make sense forget PHP's DateTime > builtin class) > > How do I do that using AutoDiscovery? > > PHP doesn't have all the types that I can ask for. > > If I use PHP's types, they are all strings. So any junk can be put in. > > The consumer of the service isn't PHP, but (I believe) C#. So strongly typed. > > > It isn't about mapping PHP "types" to W3C types. and now i completely follow after downloading the Zend code - which strategy are you currently using / need to use? either way I guess the two simplest approaches would either be: 1: create a class which extends Zend_Soap_Wsdl_Strategy_YOURCURRENTSTRATEGYCHOICE , and implement the addComplexType() method adding in all the xsd extra types and then calling parent::addComplexType when not found. 2: create a class which extends Zend_Soap_Wsdl and overrides the getType() method adding in all the xsd extra types and then calling parent::getType when not found. regards! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php