[Xml-compile] Adding HTTP header in SOAP response

Mark Overmeer mark at overmeer.net
Mon Dec 3 16:34:47 GMT 2012


* Alex Bernier (alex.bernier at free.fr) [121203 15:54]:
> I plan to implement a SOAP server using XML::Compile::SOAP::Daemon. To
> be compliant with the spec, the server should be able to send a cookie
> embeeded it in the "Set-Cookie" HTTP response header.

Never thought of that.  SOAP has other session ideas in its spec, for
instance via its own header.  And in the daemon context, you have
a "connection" with multiple request as 1 session.  Anyway...

> Is it possible to do so using XML::Compile::SOAP::* ? If yes, could
> you please send me a link to the right place in the documentation or to
> sample code ?
 
Depends on your daemon.  One of the LWP based? 

::LWPutil::lwp_run_request has a postproc parameter which can be
a code-ref, called just before the response is sent.  It is set via

  ::Daemon::???->new(postprocess => \&post);

It depends on the backend which parameters are passed in.  For LWP:

  sub post($$$$)
  {   my ($request, $response, $rc, $ref_body) = @_;
      ... here you can modify the $response headers (I guess)
  }

> I read the "Adding HTTP headers" of the XML::Compile::FAQ : if
> I understand correctly, the sample applies to SOAP client. I am not
> familiar enough with the XML::Compile::SOAP::* logic to know if/how
> these samples can be applied in a server context.

Correct.
-- 
Regards,
               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark at Overmeer.net                          solutions at overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net




More information about the Xml-compile mailing list