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

I'm not sure why you linked me to a perlmonks thread, but are they making their own serializer?

If I copy paste my tips, people don't like it

I assumed you were talking about HTTP headers, so I linked an example, that also happened to link my tips

But here you go, there is serializer example in links of one of these links below, happy hunting

Here is my copy/paste of my soap tips (I hate soap), SOAP::Lite is too much work, SOAP::Simple is less work (but its simple, when stuck go to XML::Compile::SOAP, more verbose, but you want verbose with SOAP ) ... its built on XML::Compile::SOAP/http://perl.overmeer.net/xml-compile/#doc , see my treasure trove of soap examples and lost knowledge,$soap->transport->add_handler("request_send", \&pp_dump );, http://cookbook.soaplite.com/, SOAP endpoint , Re^3: SOAP::Lite login setup, Re: I do not understand how to write a SOAP server., An XML Overview Towards Understanding SOAP, Re^3: SOAP::Lite and custom envelopes, The XML FIles: Understanding XML Namespaces, How to Call a .NET-based Web Service Using the SOAP::Lite Perl Library (2002 )

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

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

    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!

Re^4: [SOAP::Lite] Obtain request body before request is sent?
by three18ti (Monk) on Jan 29, 2015 at 03:19 UTC

    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

      Hmm, lets see,
      $ perldoc LWP::UserAgent |grep -i hook $

      Ooops, the example didn't use hook, it used handler

      $ perldoc LWP::UserAgent |grep -i handler Handlers Handlers are code that injected at various phases during the proce +ssing handlers: $ua->add_handler( $phase => \&cb, %matchspec )

        So maybe we're talking about something different?

        $ua->default_header( $field => $value ) This is just a short-cut for $ua->default_headers->header( $field +=> $value ). Example: $ua->default_header('Accept-Encoding' => scalar HTTP::Message::d +ecodable()); $ua->default_header('Accept-Language' => "no, en");

        So couldn't I do something like:

        $client->transport->default_header( 'my_special_header' => 'sha1hash') +;

        EDIT: hmm... this in the LWP doc confuses me,

        request_preprepare => sub { my($request, $ua, $h) = @_; ... } The handler is called before the request_prepare and other standar +d initialization of the request. This can be used to set up headers a +nd attributes that the request_prepare handler depends on. Proxy init +ialization should take place here; but in general don't register hand +lers for this phase.

        Is it saying in the request_prepare is where I should set my headers, or is this merely an option? I can't tell if $client->transport->default_headers() is working. haha. Was working on exporting a pcap (I develop on a vm but have wireshark locally)

        Thanks for all the guidance. I can't tell if my frustration is coming through in my posts (which usually means it is) but it certainly isn't directed at you Anonymous Monk. I really do appreciate your helping me through all this.

        EDIT: Hahaha!!!! IT does work, it helps to spell the name of the key right!

        $client->transport->default_header( 'properly-speleeed-key' => $value +);

        Does exactly what I want!!!