From: Jason S. <jas...@gm...> - 2008-09-10 14:32:29
|
Hey Soapers, Here is a message I just posted to the MOBY group. questions: 1) Why does SOAP::SOM::match() discard all the attributes on internal XML elements? Isn't this a bug? 2) Why doesn't the SOM class have a method like document() that returns the XML payload of the soap:Body tag? This seems important for easy implementation of document/literal encoding. Cheers, jas. ---------- Forwarded message ---------- From: Jason Stewart <jas...@gm...> Date: Wed, Sep 10, 2008 at 7:58 PM Subject: More info on SOAP::Lite document/literal To: Core developer announcements <mob...@li...> Hey Eddie, So I dug a bit on the server side and this is what I found. If your server class subclasses from SOAP::Server::Parameters, the method will get an extra parameter of type SOAP::SOM which gives access to all the request information. That object contains a lot of methods for searching the soap envelope - but it converts all the data it finds into a SOAP::Data instance - which throws away all attributes not located at the root of the data being returned. For example if the XML looked like this: <soap:Body> <q0:sayHello xmlns="urn:HelloWorld#"> <name>Joe Blow</name> <givenName middlename="Windy">Joe</givenName> </q0:sayHello> </soap:Body> and we did a query like $root = $som->dataof('//Body'), then $root would be the soap:Body and we would see all of the sub-elements but not their attributes. Only if we do $gn = $som->dataof('//givenName') do we actually get the givenName element with the middlename attribute still intact. But the $som object has all the information in an internal hash table - both as a hash table representation of the entire message and the HTTP::Request object with the original XML. What I don't understand is why when the dataof() method traverses the internal hash table structure it throws away all the attributes not on the root element being returned. Also, I don't understand why there isn't a method that just returns the content of the soap:Body element as plain XML - this should be the default behavior for document/literal. I would like to see a call something like $xml = $som->document(); Any thoughts of how I could make this interface most useful for MOBY purposes? I will have to alter the internal SOAP::Lite code, and send the patches to the maintainers. Cheers, jas. |