SOAP-Lite

 view release on metacpan or  search on metacpan

t/Issues/rt72836.t  view on Meta::CPAN

use strict;
use warnings;

package DoThingsWithStuff;

use SOAP::Lite;
our @ISA = qw(SOAP::Server::Parameters);

sub new {
    my ( $class ) = @_;
    my $self = bless {}, ref($class) || $class;
    $self;
}

sub do_something {
    my $self = shift;
    my $som = pop;
    #$som->context->serializer->encodingStyle(""); # does adding this affect the fix?
    return SOAP::Data->name(wotsit => "doofer");
}

package main;

use Test::More;
use SOAP::Lite;
eval { require Test::XML }
    or plan skip_all => 'Cannot test without Test::XML';

my $req11 = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:Something"><soapenv:Header/><soapenv:Body><urn:do_something><stuff>things</stuff></urn:do_something></soapenv:Body></soapenv:Envelope>';

my $req12 = '<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:urn="urn:Something"><soapenv:Header/><soapenv:Body><urn:do_something><stuff>things</stuff></urn:do_something></soapenv:Body></soapenv:Envelope>';

my $expected_11 = '<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="h...

my $expected_12 = '<?xml version="1.0" encoding="UTF-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soapenc="http://www.w3.org/2003/05/soap-encoding" xmlns:xsd="http://www.w3.org/2001/XMLSchema" soap:encodingStyle="htt...

my $t = DoThingsWithStuff->new;

my $s = SOAP::Server->new;
$s->dispatch_with({
    "urn:Something" => $t
});

my $res_11_1 = $s->handle($req11);
Test::XML::is_xml($res_11_1, $expected_11, "Got correct SOAP 1.1 response");

my $res_12 = $s->handle($req12);
Test::XML::is_xml($res_12, $expected_12, "Got correct SOAP 1.2 response");

my $res_11_2 = $s->handle($req11);
Test::XML::is_xml($res_11_2, $expected_11, "Got correct SOAP 1.1 response after processing a SOAP 1.2 request");

done_testing;

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.007 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )