WSDL operations: input and output complex types : attribute vs. element
Posted on 2011-05-12
this is a webservice / wsdl question.
when defining the input and output complex types in a wsdl Operation, we can use elements or attributes for those complex types.
what is the point with choosing attributes instead of elements ?
As i can see, the classes used make no difference:
if i define in wsdl an operation findBooksByCriteria,
with an input complex type Criteria containing elements maxPrice and minPrice
with an output complex type booksList containing Books with attributes Title, Author, Price
i can use a class Criteria with properties maxPrice and minPrice as a parameter when calling the method on soapClient,
and i get an object containing a list of objects with properties Title, Author and Price.
Everything works fine (php 5.3), but i don't understand when / why use attribute or element.
i understand the difference between an element and an attribute (in XSD point of view) but i can't see the implications in the corresponding classes.
Thank you for your time and help.