in reply to [SOLVED][SOAP::Lite] Obtain request body before request is sent?

$soap->transport is your LWP object, so hook it regular LWP style, I got example in my SOAP FAQ

OTOH, XML::Compile::SOAP... probably already does whatever it is you're doing ...

  • Comment on Re: [SOAP::Lite] Obtain request body before request is sent?

Replies are listed 'Best First'.
Re^2: [SOAP::Lite] Obtain request body before request is sent?
by three18ti (Monk) on Jan 28, 2015 at 02:54 UTC

    so what happens when I call $client->my_api_method? A serializer is called? I think it would be ideal to just modify how the default serializer behaves rather than roll my own...

    What is "regular LWP style"?

    I'm not sure why you linked me to a perlmonks thread, but are they making their own serializer? I think that was the answer to the original question on how to compose a specific message body? That makes me nervous, I'm still not really sure I understand all that is going on with SOAP::Lite, so I'm sorry if these are really obvious questions.

    Thanks for the reply!

    EDIT: there's a $client->call($method => @arguments); that is designed to allow the program control over the call. so maybe I can "manually" do what $client->my_api_method(\%params) does.

    EDIT2: There's references in the docs to SOAP::Serializer all over the place. <code> serializer(optional serializer object) $serial = $client->serializer( ) Gets or sets the serializer object used for creating XML messages. See SOAP::Serializer for details. Gives the application access to the type-lookup table from the serializer object. See the section on SOAP::Serializer. If you want change behavior for specific instance of SOAP::Lite, you may subclass SOAP::Serializer, override as_string() method that is responsible for string encoding (take a look into as_base64Binary()) and specify new serializer class for your SOAP::Lite object with: <code>

    but the link to SOAP::Serializer https://metacpan.org/pod/SOAP::Serializer only says it's used internally by SOAP::Lite. I think that's the way to go... but no docs! lol

        Doh! you're absolutely right. It is the HTML headers that I need to modify. Thanks for the clarification :) I'm dealing with a few new technologies on this project.

        Lots of reading material, thanks!

        Ok, circling back around to this.

        How do I modify the HTTP header before SOAP::Lite dispatches the request?

        Frankly, I have no idea how to use XML::Compile, my grasp on SOAP::Lite is tenuous at best, so my attempts to replicate my working script with XML::Compile have been complete fail.

        You said that you linked to an example where you were modifying the HTTP headers, but all I see is a hook that... calls the pp_twig sub. I'm not sure what it's doing, but as far as I can tell, it has nothing to do with the HTTP request headers. I'm pretty sure SOAP::Transport will be involved?

        thanks for the guidance

        EDIT: I think I need to be looking at LWP::UserAgent, not SOAP::Transport