home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2000 May
/
Chip_2000-05_cd1.bin
/
zkuste
/
Perl
/
ActivePerl-5.6.0.613.msi
/
䆊䌷䈹䈙䏵-䞅䞆䞀㡆䞃䄦䠥
/
_44aef12c29be2e0e53b9a9fda01afd13
< prev
next >
Wrap
Text File
|
2000-03-23
|
6KB
|
151 lines
<HTML>
<HEAD>
<TITLE>SOAP::OutputStream - Writes SOAP fragments</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::OutputStream - Writes SOAP fragments</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="#the simple_accessor function">The simple_accessor function</A></LI>
<LI><A HREF="#the compound_accessor function">The compound_accessor function</A></LI>
<LI><A HREF="#the reference_accessor function">The reference_accessor function</A></LI>
<LI><A HREF="#the term function">The term function</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::OutputStream - Writes SOAP fragments</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>
<PRE>
# note that we need SOAP::Envelope to bootstrap
use SOAP::Envelope;</PRE>
<PRE>
sub output_fcn {
my $string = shift;
print $string;
}</PRE>
<PRE>
my $namespaces_to_preload = ["urn:foo", "urn:bar"];
my $env = SOAP::Envelope->new(\&output_fcn,
$namespaces_to_preload);
my $body = $env->body();
</PRE>
<PRE>
# here is where we actually use SOAP::OutputStream
my $child = $body->compound_accessor("urn:quux", "reverse_string", undef, undef, 0);</PRE>
<PRE>
$child->simple_accessor(undef, "s", undef, undef, "dlrow olleH");</PRE>
<PRE>
$child->term();
$body->term();
$env->term();</PRE>
<P>This creates the following XML:</P>
<P><s:Envelope xmlns:s=``urn:schemas-xmlsoap-org:soap.v1''
xmlns:xsi=``http://www.w3.org/1999/XMLSchema''
xmlns:n1=``urn:foo''
xmlns:n2=``urn:bar''>
<s:Body>
<n3:reverse_string xmlns:n3=``urn:quux''>
<s>dlrow olleH</s>
</n3:reverse_string>
</s:Body>
</s:Envelope></P>
<P>
<HR>
<H1><A NAME="description">DESCRIPTION</A></H1>
<P>SOAP::OutputStream encapsulates the details of writing SOAP packets into a few easy
to use functions. In order to bootstrap a SOAP stream (and get your first
SOAP::OutputStream reference), you'll need to use SOAP::Envelope, as shown in
the example above.</P>
<P>
<H2><A NAME="the simple_accessor function">The simple_accessor function</A></H2>
<P>This function writes a simple accessor (e.g., a string or number, as opposed
to a compound type). It takes two sets of URI/typenames, one for the accessor
and one for the optional xsd:type attribute. At a minimum, you must specify the
accessor_name and content.</P>
<P>
<H2><A NAME="the compound_accessor function">The compound_accessor function</A></H2>
<P>This function opens a new compound accessor (by writing an open XML tag), and
returns a new SOAP::OutputStream that you should use to write the contents of that
accessor. This function always creates nested elements. If you want to create
an independent element, call reference_accessor instead. The is_package parameter
allows you to open a new package at this node; the OutputStream will write all
further independent elements at this level in the XML document, creating a
standalone XML fragment within the SOAP envelope. The OutputStream will complain
if all references within the package cannot be resolved when this node is closed.
See the SOAP spec for details on packages.</P>
<P>
<H2><A NAME="the reference_accessor function">The reference_accessor function</A></H2>
<P>This function creates a reference (SOAP:href) node, and stores the specified
object until the current package is closed, at which time a serializer is obtained
for the object (based on its type) and is asked to serialize itself to
a new stream at the level of the package. Note that if you're not using
packages explicitly, then the system will perform this resolution and
serialization when you switch from creating Headers to creating the Body,
and once again when the Body is terminated. The object referenced is guaranteed
to only be serialized once (assuming you've obeyed the SOAP rules for packages
and Header/Body object reference sharing).</P>
<P>
<H2><A NAME="the term function">The term function</A></H2>
<P>Call this function when you want to close the node you're working with.
This does several things - it seals the package if the node you're using
was created as a package, and it writes an end tag (along with doing some
other internal bookeeping that's pretty important). Don't forget to call
this function before opening a new sibling node.</P>
<P>
<HR>
<H1><A NAME="dependencies">DEPENDENCIES</A></H1>
<P>SOAP::Defs</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::OutputStream - Writes SOAP fragments</P></STRONG>
</TD></TR>
</TABLE>
</BODY>
</HTML>