ActivePerl Documentation
|
NAMESOAP::EnvelopeMaker - Creates SOAP envelopes
SUPPORTED PLATFORMS
SYNOPSISuse SOAP::EnvelopeMaker; my $soap_request = ''; my $output_fcn = sub { $soap_request .= shift; }; my $em = SOAP::EnvelopeMaker->new($output_fcn); my $body = { origin => { x => 10, y => 20 }, corner => { x => 100, y => 200 }, }; $em->set_body(``urn:com-develop-geometry'', ``calculateArea'', 0, $body); my $endpoint = ``http://soapl.develop.com/soap?class=Geometry''; my $method_uri = ``urn:com-develop-geometry''; my $method_name = ``calculateArea''; use SOAP::Transport::HTTP::Client; my $soap_on_http = SOAP::Transport::HTTP::Client->new(); my $soap_response = $soap_on_http->send_receive($endpoint, $method_uri, $method_name, $soap_request); use SOAP::Parser; my $soap_parser = SOAP::Parser->new(); $soap_parser->parsestring($soap_response); my $area = $soap_parser->get_body()->{area}; print ``The area is: $area\n'';
DESCRIPTIONThe overall usage pattern of SOAP::EnvelopeMaker is as follows: 1) Determine what you want to do with the resulting SOAP packet and create an output function that implements this policy. 2) Create an instance of SOAP::EnvelopeMaker, passing a reference to your output function. (note that somebody may already have done these first two steps on your behalf and simply passed you a reference to a pre-initialized EnvelopeMaker - see SOAP::Transport::HTTP::Server for an example) 3) (optional) Call add_header one or more times to specify headers. 4) (required) Call set_body to specify the body. 5) Throw away the EnvelopeMaker and do something with the envelope that you've collected via your output function (assuming you've not simply been piping the output somewhere as it's given to you). EnvelopeMaker expects that you'll add *all* your headers *before* setting the body - if you mess this up, the results are undefined. By the time set_body returns, a complete SOAP envelope will have been sent to your output function (in one or more chunks). You can
|
|
SOAP::EnvelopeMaker - Creates SOAP envelopes |