SOAP-WSDL - Re: mucking with namespaces

Posted on Tue Apr 22 04:18:25 2008 by noah in response to 7716 (See the whole thread of 3)
Re: mucking with namespaces
Nope. If I prefix all elements with 'ns2:', I get the same error as the first example in my previous email; I just need the method call prefixed. (I've been told this is a known bug in the SOAP server I'm hitting that will be fixed eventually). I wound up subclassing SOAP::WSDL::Serializer::XSD thusly:
sub serialize { my ($self, $args_of_ref) = @_; my $xml = $self->SUPER::serialize($args_of_ref); $xml =~ s#>#xmlns:ns2=\"http://services.company.com/\">#; return $xml; } sub serialize_body { my ($self, $name, $data, $opt) = @_; $data->__set_name("ns2:$name"); no warnings 'redefine'; *MyElements::getElement::get_xmlns = sub { '' }; return $self->SUPER::serialize_body($name, $data, $opt); }
If it helps, what I'm looking for is the same functionality one would get by calling...
$soap->ns('http://services.company.com/', 'ns2');
...in SOAP::Lite. My immediate problem is solved, but if there's a better way to get this done, I'm all ears. =) Thanks, Noah
Write a response