home *** CD-ROM | disk | FTP | other *** search
-
- <HTML>
- <HEAD>
- <TITLE>SOAP::EnvelopeMaker - Creates SOAP envelopes</TITLE>
- <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
- <LINK REV="made" HREF="mailto:">
- </HEAD>
-
- <BODY>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> SOAP::EnvelopeMaker - Creates SOAP envelopes</P></STRONG>
- </TD></TR>
- </TABLE>
-
- <A NAME="__index__"></A>
- <!-- INDEX BEGIN -->
-
- <UL>
-
- <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
-
- <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
- <LI><A HREF="#description">DESCRIPTION</A></LI>
- <UL>
-
- <LI><A HREF="#new(outputfcn)"><CODE>new(OutputFcn)</CODE></A></LI>
- <LI><A HREF="#add_header(accessoruri, accessorname, mustunderstand, ispackage, object)">add_header(AccessorUri, AccessorName, MustUnderstand, IsPackage, Object)</A></LI>
- <LI><A HREF="#set_body(accessoruri, accessorname, ispackage, object)">set_body(AccessorUri, AccessorName, IsPackage, Object)</A></LI>
- </UL>
-
- <LI><A HREF="#dependencies">DEPENDENCIES</A></LI>
- <LI><A HREF="#author">AUTHOR</A></LI>
- <LI><A HREF="#see also">SEE ALSO</A></LI>
- </UL>
- <!-- INDEX END -->
-
- <HR>
- <P>
- <H1><A NAME="name">NAME</A></H1>
- <P>SOAP::EnvelopeMaker - Creates SOAP envelopes</P>
- <P>
- <HR>
- <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
- <UL>
- <LI>Linux</LI>
- <LI>Solaris</LI>
- <LI>Windows</LI>
- </UL>
- <HR>
- <H1><A NAME="synopsis">SYNOPSIS</A></H1>
- <P>use SOAP::EnvelopeMaker;</P>
- <P>my $soap_request = '';
- my $output_fcn = sub {
- $soap_request .= shift;
- };
- my $em = SOAP::EnvelopeMaker->new($output_fcn);</P>
- <P>my $body = {
- origin => { x => 10, y => 20 },
- corner => { x => 100, y => 200 },
- };</P>
- <P>$em->set_body(``urn:com-develop-geometry'', ``calculateArea'', 0, $body);</P>
- <P>my $endpoint = ``http://soapl.develop.com/soap?class=Geometry'';
- my $method_uri = ``urn:com-develop-geometry'';
- my $method_name = ``calculateArea'';</P>
- <P>use SOAP::Transport::HTTP::Client;</P>
- <P>my $soap_on_http = SOAP::Transport::HTTP::Client->new();</P>
- <P>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);</P>
- <P>my $area = $soap_parser->get_body()->{area};</P>
- <P>print ``The area is: $area\n'';</P>
- <P>
- <HR>
- <H1><A NAME="description">DESCRIPTION</A></H1>
- <P>The overall usage pattern of SOAP::EnvelopeMaker is as follows:</P>
- <P>1) Determine what you want to do with the resulting SOAP packet
- and create an output function that implements this policy.</P>
- <P>2) Create an instance of SOAP::EnvelopeMaker, passing a reference
- to your output function.</P>
- <P>(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)</P>
- <P>3) (optional) Call add_header one or more times to specify headers.</P>
- <P>4) (required) Call set_body to specify the body.</P>
- <P>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).</P>
- <P>EnvelopeMaker expects that you'll add *all* your headers *before*
- setting the body - if you mess this up, the results are undefined.</P>
- <P>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</P>
- <P>
- <H2><A NAME="new(outputfcn)"><CODE>new(OutputFcn)</CODE></A></H2>
- <P>OutputFcn should accept a single scalar parameter, and will be called
- multiple times with chunks of the SOAP envelope as it is constructed.
- You can either append these chunks into a big string, waiting until
- the entire envelope is constructed before you do something with it
- (like calculate the content-length, for instance), or you can simply
- pipe each chunk directly to somebody else.</P>
- <P>
- <H2><A NAME="add_header(accessoruri, accessorname, mustunderstand, ispackage, object)">add_header(AccessorUri, AccessorName, MustUnderstand, IsPackage, Object)</A></H2>
- <P>The first two parameters allow you to specify a QName (qualified name)
- for your header. Note that in SOAP, all headers MUST be namespace
- qualified. MustUnderstand and IsPackage turn on SOAP features that are
- explained in the SOAP spec; if you haven't yet grok'd SOAP packages,
- just pass 0 for IsPackage. Finally, Object is whatever you'd like to
- serialize into the header (see set_body for notes on what can go here;
- headers can contain the same stuff as the body).</P>
- <P>
- <H2><A NAME="set_body(accessoruri, accessorname, ispackage, object)">set_body(AccessorUri, AccessorName, IsPackage, Object)</A></H2>
- <P>The first two parameters allow you to specify a QName (qualified name)
- for the body. The name of the accessor is the name of the SOAP method
- call you're making. IsPackage says that the body will be a SOAP package;
- just pass 0 if you're not sure what this means. Object is whatever you'd
- like to serialize. This can be one of the following things:</P>
- <P>1) a scalar - the body will contain the scalar content.</P>
- <P>2) a hash reference - the body will contain a SOAP serialized version
- of the contents of the hash.</P>
- <P>Note that the SOAP/Perl serialization architecture deals with references
- very carefully, so it is possible to pass arbitrary object graphs (although
- each ``object reference'' must currently be a non-blessed scalar or hash reference).</P>
- <P>In the future, expect to see support for passing blessed object references
- (if you want to do this today, see the experimental SOAP::TypeMapper).</P>
- <P>One interesting thing SOAP (and SOAP/Perl) support is that the headers
- and body can share references. They can point to the same stuff. Also,
- cycle detection is a natural part of SOAP/Perl's serialization architecture,
- so you can pass linked lists, circular queues, etc. and they will be
- rehydrated correctly.</P>
- <P>
- <HR>
- <H1><A NAME="dependencies">DEPENDENCIES</A></H1>
- <P>SOAP::Envelope</P>
- <P>
- <HR>
- <H1><A NAME="author">AUTHOR</A></H1>
- <P>Keith Brown</P>
- <P>
- <HR>
- <H1><A NAME="see also">SEE ALSO</A></H1>
- <P>SOAP::Envelope</P>
- <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
- <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
- <STRONG><P CLASS=block> SOAP::EnvelopeMaker - Creates SOAP envelopes</P></STRONG>
- </TD></TR>
- </TABLE>
-
- </BODY>
-
- </HTML>
-