estoque has asked for the wisdom of the Perl Monks concerning the following question:

Good day monks, I would like to ask some help on this problem: I would like to achieve this format on soap body-
<tns1:receive xmlns:tns1="http://eBonding/taservice/callback">XML DATA</tns1:receive>
I tried using this code-
my $xml = "-XML DATA-"; my $soap = SOAP::Lite -> ns('http://eBonding/taservice/callback','tns1') -> proxy('https://b2b-ace-uat.gcsc.att.com/soap/WsRouter') -> receive($xml, $security->value(\$userToken));

but it only generates this-
<tns1:receive> XML-DATA </tns1:receive>
as you can see the namespace was removed.
then trying this code will only remove the prefix tns1:
my $xml = "-XML DATA-"; my $soap = SOAP::Lite -> default_ns('http://eBonding/taservice/callback') -> proxy('https://b2b-ace-uat.gcsc.att.com/soap/WsRouter') -> receive($xml, $security->value(\$userToken));

The documentation said that I can achieve this by using ns($namespace, $prefix) but this is not happening to me. I would appreciate your help. I am using SOAP::Lite 1.19

Replies are listed 'Best First'.
Re: SOAP: missing namespace
by Anonymous Monk on Feb 01, 2016 at 22:35 UTC

    I would like to achieve this format on soap body-

    I kind of doubt that :D

    You say you get tns1:receive , well, as far as SOAP/XML is concerned, that's the same as  tns1:receive xmlns:tns1="http://eBonding/taservice/callback"

    Now you may be able to tickle some SOAP::Lite option and get it to do what you want, but I would opt for modifying call, a serializer, ... UTSL

    XML::Compile::SOAP looks like a better idea to me :) or even crafting raw xml using XML::LibXML

      Fixed. That UTSL really helped and opened a lot of possibilities for me. LOL. I modified SOAP/Lite.pm then found the code around line #1638 which is supposedly to fix namespace prefix issues.

        ... I modified SOAP/Lite.pm ...

        make a subclass instead of editing Lite.pm, that way when SOAP::Lite gets updated, your changes aren't gone