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 >
Text File  |  2000-03-23  |  6KB  |  151 lines

  1.  
  2. <HTML>
  3. <HEAD>
  4. <TITLE>SOAP::OutputStream - Writes SOAP fragments</TITLE>
  5. <LINK REL="stylesheet" HREF="../../../Active.css" TYPE="text/css">
  6. <LINK REV="made" HREF="mailto:">
  7. </HEAD>
  8.  
  9. <BODY>
  10. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  11. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  12. <STRONG><P CLASS=block> SOAP::OutputStream - Writes SOAP fragments</P></STRONG>
  13. </TD></TR>
  14. </TABLE>
  15.  
  16. <A NAME="__index__"></A>
  17. <!-- INDEX BEGIN -->
  18.  
  19. <UL>
  20.  
  21.     <LI><A HREF="#name">NAME</A></LI><LI><A HREF="#supportedplatforms">SUPPORTED PLATFORMS</A></LI>
  22.  
  23.     <LI><A HREF="#synopsis">SYNOPSIS</A></LI>
  24.     <LI><A HREF="#description">DESCRIPTION</A></LI>
  25.     <UL>
  26.  
  27.         <LI><A HREF="#the simple_accessor function">The simple_accessor function</A></LI>
  28.         <LI><A HREF="#the compound_accessor function">The compound_accessor function</A></LI>
  29.         <LI><A HREF="#the reference_accessor function">The reference_accessor function</A></LI>
  30.         <LI><A HREF="#the term function">The term function</A></LI>
  31.     </UL>
  32.  
  33.     <LI><A HREF="#dependencies">DEPENDENCIES</A></LI>
  34.     <LI><A HREF="#author">AUTHOR</A></LI>
  35.     <LI><A HREF="#see also">SEE ALSO</A></LI>
  36. </UL>
  37. <!-- INDEX END -->
  38.  
  39. <HR>
  40. <P>
  41. <H1><A NAME="name">NAME</A></H1>
  42. <P>SOAP::OutputStream - Writes SOAP fragments</P>
  43. <P>
  44. <HR>
  45. <H1><A NAME="supportedplatforms">SUPPORTED PLATFORMS</A></H1>
  46. <UL>
  47. <LI>Linux</LI>
  48. <LI>Solaris</LI>
  49. <LI>Windows</LI>
  50. </UL>
  51. <HR>
  52. <H1><A NAME="synopsis">SYNOPSIS</A></H1>
  53. <PRE>
  54.     # note that we need SOAP::Envelope to bootstrap
  55.     use SOAP::Envelope;</PRE>
  56. <PRE>
  57.     sub output_fcn {
  58.         my $string = shift;
  59.         print $string;
  60.     }</PRE>
  61. <PRE>
  62.     my $namespaces_to_preload = ["urn:foo", "urn:bar"];
  63.     my $env = SOAP::Envelope->new(\&output_fcn,
  64.                                   $namespaces_to_preload);
  65.     my $body = $env->body();
  66. </PRE>
  67. <PRE>
  68.  
  69.     # here is where we actually use SOAP::OutputStream
  70.     my $child = $body->compound_accessor("urn:quux", "reverse_string", undef, undef, 0);</PRE>
  71. <PRE>
  72.     $child->simple_accessor(undef, "s", undef, undef, "dlrow olleH");</PRE>
  73. <PRE>
  74.     $child->term();
  75.     $body->term();
  76.     $env->term();</PRE>
  77. <P>This creates the following XML:</P>
  78. <P><s:Envelope xmlns:s=``urn:schemas-xmlsoap-org:soap.v1'' 
  79.             xmlns:xsi=``http://www.w3.org/1999/XMLSchema'' 
  80.             xmlns:n1=``urn:foo'' 
  81.             xmlns:n2=``urn:bar''>
  82.   <s:Body>
  83.     <n3:reverse_string xmlns:n3=``urn:quux''>
  84.       <s>dlrow olleH</s>
  85.     </n3:reverse_string>
  86.   </s:Body>
  87. </s:Envelope></P>
  88. <P>
  89. <HR>
  90. <H1><A NAME="description">DESCRIPTION</A></H1>
  91. <P>SOAP::OutputStream encapsulates the details of writing SOAP packets into a few easy
  92. to use functions. In order to bootstrap a SOAP stream (and get your first
  93. SOAP::OutputStream reference), you'll need to use SOAP::Envelope, as shown in
  94. the example above.</P>
  95. <P>
  96. <H2><A NAME="the simple_accessor function">The simple_accessor function</A></H2>
  97. <P>This function writes a simple accessor (e.g., a string or number, as opposed
  98. to a compound type). It takes two sets of URI/typenames, one for the accessor
  99. and one for the optional xsd:type attribute. At a minimum, you must specify the
  100. accessor_name and content.</P>
  101. <P>
  102. <H2><A NAME="the compound_accessor function">The compound_accessor function</A></H2>
  103. <P>This function opens a new compound accessor (by writing an open XML tag), and
  104. returns a new SOAP::OutputStream that you should use to write the contents of that
  105. accessor. This function always creates nested elements. If you want to create
  106. an independent element, call reference_accessor instead. The is_package parameter
  107. allows you to open a new package at this node; the OutputStream will write all
  108. further independent elements at this level in the XML document, creating a
  109. standalone XML fragment within the SOAP envelope. The OutputStream will complain
  110. if all references within the package cannot be resolved when this node is closed.
  111. See the SOAP spec for details on packages.</P>
  112. <P>
  113. <H2><A NAME="the reference_accessor function">The reference_accessor function</A></H2>
  114. <P>This function creates a reference (SOAP:href) node, and stores the specified
  115. object until the current package is closed, at which time a serializer is obtained
  116. for the object (based on its type) and is asked to serialize itself to
  117. a new stream at the level of the package. Note that if you're not using
  118. packages explicitly, then the system will perform this resolution and
  119. serialization when you switch from creating Headers to creating the Body,
  120. and once again when the Body is terminated. The object referenced is guaranteed
  121. to only be serialized once (assuming you've obeyed the SOAP rules for packages
  122. and Header/Body object reference sharing).</P>
  123. <P>
  124. <H2><A NAME="the term function">The term function</A></H2>
  125. <P>Call this function when you want to close the node you're working with.
  126. This does several things - it seals the package if the node you're using
  127. was created as a package, and it writes an end tag (along with doing some
  128. other internal bookeeping that's pretty important). Don't forget to call
  129. this function before opening a new sibling node.</P>
  130. <P>
  131. <HR>
  132. <H1><A NAME="dependencies">DEPENDENCIES</A></H1>
  133. <P>SOAP::Defs</P>
  134. <P>
  135. <HR>
  136. <H1><A NAME="author">AUTHOR</A></H1>
  137. <P>Keith Brown</P>
  138. <P>
  139. <HR>
  140. <H1><A NAME="see also">SEE ALSO</A></H1>
  141. <P>SOAP::Envelope</P>
  142. <TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>
  143. <TR><TD CLASS=block VALIGN=MIDDLE WIDTH=100% BGCOLOR="#cccccc">
  144. <STRONG><P CLASS=block> SOAP::OutputStream - Writes SOAP fragments</P></STRONG>
  145. </TD></TR>
  146. </TABLE>
  147.  
  148. </BODY>
  149.  
  150. </HTML>
  151.