[Xml-compile] How to debug schema problems

Uwe Voelker uwe at uwevoelker.de
Fri Apr 19 18:42:55 GMT 2013


Hello,

Mark, thank you for your helpful hints. Unfortunately I was not able to fix
my problem. But I would like to share what I did, maybe it helps others.

Narrowing down without invalidating the message is often hard.  It requires
> a lot of knowledge from the schema.  Examples how to test returns
> locally can be found in the test-scripts of the distribution, for instance
> t/50wsdl.t  (fake_server)
>

I saw the hook parameter in the transport class. But I couldn't pass it in
via the compileCalls method (or any other method I tried). But then I saw
the transport parameter to compileCalls and I subclassed
XML::Compile::Transport::SOAPHTTP:


package MyTransport;

use strict;
use warnings;

use base 'XML::Compile::Transport::SOAPHTTP';

use File::Slurp;
use HTTP::Response;

sub _prepare_call {
    my ($self, $args) =3D @_;
    $args ||=3D {};
    $args->{hook} =3D \&transport_hook;

    $self->SUPER::_prepare_call($args);
}

sub transport_hook {
    my ($request, $trace) =3D @_;

    my $xml =3D read_file('fake.xml');
    my $response =3D HTTP::Response->new(
        200,
        'OK',
        ['Content-Type' =3D> 'text/xml'],
        $xml,
    );

    return $response;
}

1;

So I could experiment with my own XML answer.

Best, Uwe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/xml-compile/attachments/20130419/24=
bd9406/attachment.htm


More information about the Xml-compile mailing list