Perl: getting a full request from a SOAP :: WSDL object

I work with SOAP::WSDLand other company custom WSDL file. Every time they change for me, and I recreate my modules, something breaks. Finding the problem is quite tedious because I did not find a suitable way to access the actual request sent to the SOAP server.

The only way to get to the request so far has been to use tcpdump in combination with wirehark to retrieve the request and result. This works, but since I do not have root privileges on the dev machine, I have to get an administrator every time if I want. I feel that there must be another way to get to the object HTTP::Requestinside the object SOAP::WSDL. But if the server returns an error, I don’t even have a response object, but rather an object SOAP::WSDL::SOAP::Typelib::Fault11that has no visible relation to the request.

I also tried using a debugger, but it's hard for me to find the actual part of the request. I still do not understand how to tell the debugger to skip a specific part within a complex number of packets.

+3
source share
3 answers

, , XML-.

-, SOAP:: WSDL:: Client, raina77ow. , . SOAP:: WSDL:: Factory:: Serializer. :

Serializer SOAP:: WSDL:: Client set_serializer.

fidgeting, - SOAP:: WSDL:: Serializer:: XSD, SOAP:: WSDL. .

, . SOAP::WSDL::Serializer::XSD new serialize. new, XML serialize , . , -, .

package MySerializer;
use strict;
use warnings;
use base qw(SOAP::WSDL::Serializer::XSD);

sub new {
  my $self = shift;
  my $class = ref($self) || $self;
  return $self if ref $self;

  # Create the base object and return it
  my $base_object = $class->SUPER::new(@_);
  return bless ($base_object, $class);
}

sub serialize {
  my ($self, $args_of_ref) = @_;

  # This is basically a wrapper function that calls the real Serializer's
  # serialize-method and grabs and prints the returned XML before it
  # giving it back to the caller

  my $xml = ref($self)->SUPER::serialize($args_of_ref);
  print "\n\n$xml\n\n"; # here we go
  return $xml;
}

1;

:

my $serializer = MySerializer->new();
$self->{'_interface'} = Lib::Interfaces::MyInterface->new();
$self->{'_interface'}->set_serializer($serializer); # comment out to deactivate

. set_serializer.

, XML , . , /, , .

0

, . , , raina77ow.

$service->outputxml(1);

SOAP- xml,

$service->no_dispatch(1);

no_dispatch , SOAP . , .

+4

Have you tried using the tracking methods SOAP :: WSDL :: Client - and outputxml in particular? It returns a raw SOAP envelope to be sent to the server.

You can also use the no_dispatch way to configure SOAP :: WSDL :

When set, call () returns an XML request for a simple request instead of sending a SOAP call to the SOAP service. Convenient for testing / debugging.

+2
source

All Articles