[Xml-compile] Using XML::Compile::WSDL with a session ID

John Smith josm911 at gmail.com
Tue Jul 21 03:06:30 GMT 2009


Hello :-)

I'm hoping someone might have a moment to offer some advice. I'm
interacting with a web service that requires all operations to be
accompanied with a session ID. What I'm using now is the below snippet
(which works just fine).

The problem is that, as I understand it, compileClient() is a "heavy"
operation, and I'd rather not have to recompile the client every time
I need to start a new session (they expire every ten min). I'd like to
just compile a client and tuck it away indefinitely and just
update/specify the session ID somehow, as necessary, separately (like
perhaps when $call->() is actually invoked somehow?). In other words,
I'm wondering if there is a way to decouple the specifying the session
ID from the compilation of the client. If anyone has any ideas at all,
I'd be grateful. Thanks in advance!

my $session_id = get_session_id(); # eg: 3e6b0456
my $path_to_wsdl_file = path_to_wsdl_file();
my $wsdl = XML::Compile::WSDL11->new($path_to_wsdl_file);
my $call = $wsdl->compileClient(
    operation => 'FooBar',
    endpoint => "https://foo.com/bar;sessionid=" . $session_id,
);
my ($answer, $trace) = $call->(foo => 'bar');

---
John



More information about the Xml-compile mailing list