Porting SOAP functions from PHP to Perl using SOAP :: WSDL

I am trying to get SOAP to work in perl.

In PHP, it works fine and without problems. And now I'm trying to do the same in Perl.

Functional PHP:

$client = new SoapClient("http://thirdpartyurl.com/api.aspx?WSDL");
$info = $client->GetSomeInfo(array('username' => 'myusername', 'password' => 'mypassword'));

Which works fine, but I just can't get it to work in perl. I tried SOAP :: Lite but did not achieve anything. And now I'm trying to use SOAP :: WSDL:

use SOAP::WSDL;
my $wsdl = SOAP::WSDL->new(wsdl => 'http://thirdpartyurl.com/api.aspx?WSDL');
my $info = $wsdl->call('GetSomeInfo', 'username', 'myusername', 'password', 'mypassword');

It just doesn't work. I looked at the raw requests and the perl version does not even send user / password parameters. What am I doing wrong?

+1
source share
3 answers

Why did I deserve authentication, and I was able to get the parameters sent using the following:

use SOAP::Lite;
my $service = SOAP::Lite->proxy($service_url)->uri($service_url);

sub SOAP::Transport::HTTP::Client::get_basic_credentials {
    return 'myusername' => 'mypassword';
}

my $result = $service->insert(
    SOAP::Data->name(
        'data' => \SOAP::Data->value(
            SOAP::Data->name(
                'item' => \SOAP::Data->value(
                    SOAP::Data->name('key' => 'name'),
                    SOAP::Data->name('value' => 'new_campaign_x')
                )
            )
        )
    )->type('Map')
);

? , "get_basic_credentials" .

+4

SOAP:: Lite . /, HTTP SOAP? ?

0

When I want to do SOAP, I turn to XML :: Compile .

-1
source

All Articles