Skip to content

Commit

Permalink
Merge branch 'whitespace-set-soapversion-before-call' into commercial…
Browse files Browse the repository at this point in the history
…-staging
  • Loading branch information
chrismytton committed May 14, 2024
2 parents 8f71ac1 + 6728eee commit 4849355
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions perllib/Integrations/Whitespace.pm
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,27 @@ has backend_type => ( is => 'ro', default => 'whitespace' );
sub call {
my ($self, $method, @params) = @_;

# SOAP::Lite uses some global constants to set e.g. the request's
# Content-Type header and various envelope XML attributes. On new() it sets
# up those XML attributes, and even if you call soapversion on the object's
# serializer after, it does nothing if the global version matches the
# object's current version (which it will!), and then uses those same
# constants anyway. So we have to set the version globally before creating
# the object (during the call to self->endpoint), and also during the
# call() (because it uses the constants at that point to set the
# Content-Type header), and then set it back after so it doesn't break
# other users of SOAP::Lite.
SOAP::Lite->soapversion(1.1);

require SOAP::Lite;
@params = make_soap_structure(@params);
my $som = $self->endpoint->call(
$method => @params,
$self->security
);

SOAP::Lite->soapversion(1.2);

# TODO: Better error handling
die $som->faultstring if ($som->fault);

Expand Down

0 comments on commit 4849355

Please sign in to comment.