[Xml-compile] xsi:type woes

Stig Brautaset stig at brautaset.org
Mon Mar 2 23:12:56 GMT 2009


I've been attempting to use XML::Compile against an internal web  
service at $WORK. A lot of it works well, but some calls fail. The  
reason is that the xsi:type attribute is omitted from the perl  
datastructure I get back, though the WSDL specifies this as far as I  
can see. Actually it's not such a problem on the get call, as I can  
live with not knowing the content on it for what I'm doing but when it  
comes to save this information back this fails because the xsi:type  
information is essential here.

I'm not sure if the problem is compounded by the XML having a bare  
"type" attribute in a different namespace as well. I'm afraid I don't  
have access to the details at home, and can't post to this list from  
work, so I'm typing this from memory. Essentially the XML I get back  
contains a snippet like this:

<ns1:collection xsi:type="ns2:Foo" type="BAR" alpha="1" beta="2" />

and the Perl structure I get omits the xsi:type attribute:

{
  type => "BAR",
  alpha => "1",
  beta => "2",
}

passing the the "xsi:type='ns2:Foo'" is, unfortunately, required in  
the corresponding update call. But the generated XML looks like this:

<ns1:collection type="BAR" alpha="1" beta="2" />

, again omitting the xsi:type attribute. I've been reading and re- 
reading the documentation, and trying out options to no avail. Is  
there some magic incantation that will preserve the xsi:type  
attribute? I'd appreciate some pointers...



Stig
-- 
http://code.brautaset.org
http://devblog.brautaset.org







More information about the Xml-compile mailing list