[wsf-c-dev][PHP]Wsdl Generation - schema types

Samisa Abeysinghe samisa at wso2.com
Wed Dec 13 06:58:27 PST 2006


James Clark wrote:
> For PHP objects, we could allow the user to specify an option on the
> WSServer that maps from PHP class names to XML schema types.  The
> current PHP SOAP extension does something similar but the other way
> round ("classmap" mapping from schema types to classes).  Of course, we
> would need to support this both at the WSDL generation level and at the
> type mapping level.  Then we need a way to actually do the conversion.
> If there's a toXML method on the class, we could call that, otherwise it
> would just convert the object to a string (which the user can control by
> specifying the __toString magic method).
>
> Another possibility would be to invent some syntax that could be put in
> the doc comment to allow the user to specify not just the PHP type but
> also the schema type and how to map from the PHP type to the schema
> type.  Again, this would need to be supported both by the WSDL
> generation and by the code that does the type mapping.
>   
IMHO, the second alternative of inventing a syntax that binds PHP to 
schema types would be more user friendly, in that the mapping is 
documented in one place unlike in alternative one.
Even in option two, I reckon that we would need toXML method to get to 
know how to serialize/de-serialize the type.
For all those trivial XSD types, such as int, string etc. we can provide 
a pre-defined type binding; so specifying the PHP type optional in the 
comment and even it is present, it could not be overridden. For all 
those non-trivial types, base64Binary etc, we could mandate the  
specification of a PHP type mapping in the doc comment and if it is 
missing, we can assume it to be 'mixed' meaning it can be anything.

Samisa...





More information about the Wsf-c-dev mailing list