Sunday, January 28, 2018

SOAP Lite Set HTTP Header

SOAP Lite Set HTTP Header


Basically everything is said on the following (I just simplyfied the text a little bit):

By default, SOAP::Lite generates a SOAPAction header with the structure of [URI]#[method].In our case however, we want the SOAPAction to be just the URI, so we have to use on_action to modify it. In our example, we specify on_action(sub { sprintf "%s", shift }), so the resulting SOAPAction will contain only the URI (and dont forget the double quotes there).
  So here is my code example:

use SOAP::Lite
my $soap_proxy = SOAP::Lite->uri([THIS IS THE URI I WANT TO USE FOR THE SOAP ACTION])->on_action(sub { sprintf "%s", shift })->proxy([HOST URL]);
(following with soap operation and parameters)

The result was that Soap::Lite did not add a # before my action. The URI was delivered as the xmlns separately. I admit, I did not figure out exactly yet how this works. But it does :)

SOURCE

visit link download