[Xml-compile] XML::Compile::WSDL11 async - HTTP headers modification

Roman Daniel roman.daniel at davosro.cz
Thu Nov 13 19:01:24 GMT 2014


Hi Mark,

I use XML::Compile::WSDL11 with an asynchronous transport. I need to
pass some HTTP headers with the calls. I don't mean "static" headers
like basic auth but headers which can change from call to call. For
example message-id (known before SOAP call)  to identify my request at
the server side.

I was looking for a way how to convert a data for an operation into
HTTP::Request and back how to convert HTTP::Response to response data.
Having it I could add the header to request, and send it. But I was
not successfull with extracting the functionality from
XML::Compile::SOAP[11]::Operation.

Then I found a very different solution, slightly wild and dependent on
XML::Compile::SOAP implementation, but simple. I use my own transport
- modification of XML::Compile::Transport::SOAPHTTP_AnyEvent. But
instead of calling AnyEvent::HTTP::http_request at the end of the
transport I just return the $request and $handler (callback) together
as a hash { request => $request, cb => $handler }.

And since this return is the last call in transport and the $transport
call is the last call of async soap in XML::Compile::SOAP::Client

$transport->($req, $trace, $mtom
          , sub { $callback->($output_handler->(@_)) }
          );

I get my $request and $cb from $client->($data) call. Then I can
modify headers and send the request via AnyEvent::HTTP. Of course I
know that this $transport->(...) call is not supposed to return a
value and an empty return after it would destroy my implementation.

What do you think about it? Is there any other solution?

Thanks for reply,

Roman Daniel



More information about the Xml-compile mailing list