From 32fe974c15087f9329b8e0b7d026102ab7e73e24 Mon Sep 17 00:00:00 2001 From: Ivan Panchenko Date: Sun, 2 Dec 2018 12:10:47 +0300 Subject: [PATCH 1/2] Empty input body support for operations in WSDL --- lib/SOAP/Lite.pm | 5 +++-- t/25-wsdl.t | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100644 t/25-wsdl.t diff --git a/lib/SOAP/Lite.pm b/lib/SOAP/Lite.pm index 2af31b5..5da3fa1 100644 --- a/lib/SOAP/Lite.pm +++ b/lib/SOAP/Lite.pm @@ -3176,8 +3176,9 @@ FAKE $services{$opername} = {}; # should be initialized in 5.7 and after my $soapaction = $_->operation->soapAction; my $invocationStyle = $_->operation->style || $default_style || "rpc"; - my $encodingStyle = $_->input->body->use || "encoded"; - my $namespace = $_->input->body->namespace || $tns; + my $inpBody = $_->input->body; + my $encodingStyle = $inpBody ? $inpBody->use || "encoded" : "encoded"; + my $namespace = $inpBody ? $inpBody->namespace || $tns : $tns; my @parts; foreach ($s->portType) { next unless $_->name eq $porttype; diff --git a/t/25-wsdl.t b/t/25-wsdl.t new file mode 100644 index 0000000..3659547 --- /dev/null +++ b/t/25-wsdl.t @@ -0,0 +1,33 @@ +#!/usr/bin/env perl + +BEGIN { + unless(grep /blib/, @INC) { + chdir 't' if -d 't'; + unshift @INC, '../lib' if -d '../lib'; + } +} + +use strict; +use Test; + +use SOAP::Lite + on_fault => sub { + my $soap = shift; + my $res = shift; + ref $res ? warn(join "\n", "--- SOAP FAULT ---", $res->faultcode, $res->faultstring, '') + : warn(join "\n", "--- TRANSPORT ERROR ---", $soap->transport->status, ''); + return new SOAP::SOM; + } +; + +my($s); + +plan tests => 1; + +{ + + ok($s = SOAP::Lite + ->service("https://demoapi.intickets.ru/soap/?wsdl&ver=1.6") + ); + +} From 653ecb546d7df3b46bf2595f8c6a450c7a382697 Mon Sep 17 00:00:00 2001 From: Ivan Panchenko Date: Sat, 17 Aug 2019 20:23:21 +0300 Subject: [PATCH 2/2] Basic authentification support for WSDL retrieval --- lib/SOAP/Lite.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/SOAP/Lite.pm b/lib/SOAP/Lite.pm index 5da3fa1..3768704 100644 --- a/lib/SOAP/Lite.pm +++ b/lib/SOAP/Lite.pm @@ -3334,6 +3334,13 @@ sub access { $req->proxy_authorization_basic($ENV{'HTTP_proxy_user'}, $ENV{'HTTP_proxy_pass'}) if ($ENV{'HTTP_proxy_user'} && $ENV{'HTTP_proxy_pass'}); + if(UNIVERSAL::can('SOAP::Transport::HTTP::Client', 'get_basic_credentials')) { + my ($http_user, $http_pass) = SOAP::Transport::HTTP::Client::get_basic_credentials(); + if ($http_user && $http_pass) { + $req->authorization_basic( $http_user, $http_pass); + } + } + my $resp = $self->useragent->request($req); $resp->is_success ? $resp->content : die "Service description '$url' can't be loaded: ", $resp->status_line, "\n"; }