XML::Compile::WSDL11 - accessing the transport layer
Toby Corkindale
tjc at wintrmute.net
Fri Apr 11 06:02:13 BST 2008
On Fri, Apr 11, 2008 at 12:08:39PM +1000, Toby Corkindale wrote:
> I'm using XML::Compile::WSDL11 to generate some SOAP services, but I want to
> get access to the LWP::UserAgent object.. to do that I need to get the
> XML::Compile::Transport::SOAPHTTP object, but it's eluding me on the correct
> incantations to retrieve it from the X-C-WSDL11 object.
>
> Can anyone help me with the missing step here?
I never did figure out the right way to get to the transport layer, and
eventually decided that X-C-T-SOAPHTTP just didn't export the package-wide
%transporters hash via any means.
I created a work-around, see below if you ever need to do this yourself:
> my $wsdl = slurp('service.wsdl');
> my $service = XML::Compile::WSDL11->new($wsdl);
my $transport = XML::Compile::Transport::SOAPHTTP->new(
address => $server_uri
);
my $ua = $transport->userAgent;
# Hurrah, now set all your custom LWP::UserAgent options.
# ...
my $call = $service->compileClient('MyService',
port => 'MyPort',
transport => $transport,
);
> $call->( answer => 42 );
In this case I already knew what the destination address URL was, and could set
it manually in $server_uri. If you don't know what it is, it can be obtained by
XML::Compile::WSDL11::Operation's endPoints() function; in order to get an
Operation object you can call ->operation on your WSDL object, but you'll have
to pass a valid operation name; a list of these is available from the
WSDL->operations function.
I welcome any suggestions on easier ways to perform this..
Toby
More information about the london.pm
mailing list