Hello Monks
This is a continuation of last nights question [SOLVED][SOAP::Lite] Obtain request body before request is sent? but I think I need to step back and understand what's going on before moving forward.
First of all, I think what I'm really after is the request envelope. I'd like to be able to print or otherwise store in a variable the XML markup in the envelope. Second of all, I need to modify the HTTP request header (not the XML header as I proposed in the above linked thread). I had my terms mixed up last night but I think I'm starting to understand better.
Anyway. What I'm really after is what happens when you call $client->my_api_method(\%params); where is the XML actually built?
Here is the code I'm working with
<#!/usr/bin/env perl use strict; use warnings; use 5.010; use LWP::UserAgent; use SOAP::Lite; use LWP::Debug; LWP::Debug::level('+'); SOAP::Lite->import(+trace => ' +all'); my $client = SOAP::Lite->proxy($proxy) ->ns($namespace, 'foo') # I'm not sure I understand this. ->uri($uri) ->on_action(sub { sprintf '%s', $_[0] }) ->on_fault(sub { my($soap, $result) = @_; die ref $result ? "Fault Code: " . $result->faultcode . "\n" . "Fault String: " . $result->faultstring . "\n" : $soap->transport->status, "\n"; }); my $params = { foo => 'bar', biz => 'baz'}; #my $data = SOAP::Data->name($params); #my $serial = $client->serializer; #my $xml = $serial->envelope($data); #print Dumper $xml; #my $result = $client->my_api_method($params); my $result = $client->call('my_api_method' => $params);
I've figured out that $client->my_api_method(\%params) is the same as $client->call('my_api_method' => \%params)
When running with trace, it looks like SOAP::Serializer is getting a hash, but when I call $serial->envelope($data) I get an error that it's "Wrong type of envelope (SOAP::Data=HASH(0x8feb78)) for SOAP call". (Of course all the docs point to the SOAP::Serialize docs say that it's used by SOAP::Lite and all the SOAP ::Lite docs say to see SOAP::Serialize... :/ http://search.cpan.org/~kbrown/SOAP-0.28/lib/SOAP/Serializer.pm I've looked at the code for SOAP::Serializer, I'm not convinced it's what's building the XML.)
What modules used by SOAP::Lite actually generate the XML here? I can generate a SOAP::Data hash, but then what do I do with it? I know I can pass it to $client->call so something behind that is generating the xml.
Thanks for the assistance.
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |