WebReceive (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (move footer template to actual end; edits, tags and links)
Line 1: Line 1:
{{Template:XmlDoc:WebReceive subtitle}}
{{Template:XmlDoc:WebReceive subtitle}}
 
<var>WebReceive</var> converts an HTTP request received on a <var class="product">[[Janus Web Server|"Janus Web Server"]]</var> thread from the text representation of an XML document to an <var>XmlDoc</var> tree (this process is called '''deserialization''', because the text representation of a document is called the '''serial''' form). It returns a zero value if the deserialization is successful or a non-zero value if unsuccessful and the <var class="term">ErrRet</var> option is used and the particular error is tolerated.
This callable function
converts an HTTP request received on a [[Janus Web Server]] thread from the text
representation of an
XML document to an <var>XmlDoc</var> tree (this process is called '''deserialization''',
because the text representation of a document is called the '''serial'''
form).
It returns a zero value if the
deserialization is successful or a non-zero value if unsuccessful and
the ErrRet option is used and the particular error is tolerated.
==Syntax==
==Syntax==
{{Template:XmlDoc:WebReceive syntax}}
{{Template:XmlDoc:WebReceive syntax}}
===Syntax terms===
===Syntax terms===
<table class="syntaxTable">
<table class="syntaxTable">
<tr><th>%errorposition</th>
<tr><th>%errorPosition</th>
<td>A %variable set to 0 if the deserialization is successful, or, if the ErrRet option is used, to the position within the uploaded data at which an error is found. </td></tr>
<td>A %variable set to 0 if the deserialization is successful, or, if the <var class="term">ErrRet</var> option is used, to the position within the uploaded data at which an error is found.</td></tr>
<tr><th>doc</th>
<tr><th>doc</th>
<td>An expression that points to the <var>XmlDoc</var> to contain the deserialized representation of the XML document. </td></tr>
<td>An expression that points to the <var>XmlDoc</var> to contain the deserialized representation of the XML document.</td></tr>
<tr><th>formFieldname</th>
<tr><th>formFieldName</th>
<td>The name of the form field associated with the "<input type=file>" tag in the HTML form, that is, the value of the "name" parameter in that tag. See the "fieldname" argument of $Web_Proc_Recv in the &JANWEBR.. </td></tr>
<td>The name of the form field associated with the "<input type=file>" tag in the HTML form, that is, the value of the "name" parameter in that tag. See the <var class="term">fieldname</var> argument of <var>[[$Web_Proc_Receive|$Web_Proc_Recv]]</var> in the <var class="product">[[Janus Web Server|"Janus Web Server"]]</var> reference manual.</td></tr>
<tr><th>fieldOccurrence</th>
<tr><th>fieldOccurrence</th>
<td>The number of the form field associated with the "<input type=file>" tag in the HTML form. See the "occurrence" argument of $Web_Proc_Recv in the &JANWEBR.. </td></tr>
<td>The number of the form field associated with the "<input type=file>" tag in the HTML form. See the <var class="term">occurrence</var> argument of <var>$Web_Proc_Recv</var> in the <var class="product">"Janus Web Server"</var> reference manual.. </td></tr>
<tr><th>options</th>
<tr><th>options</th>
<td>See the [[LoadXml (XmlDoc/XmlNode function)#options|options]] argument of <var>LoadXml</var>.</td></tr>
<td>See the <var class="term">[[LoadXml (XmlDoc/XmlNode function)#options|options]]</var> argument of <var>LoadXml</var>.</td></tr>
</table>
</table>


===Exceptions===
==Exceptions==
 
This function can throw the following exception:
This function can throw the following exception:
<dl>
<dl>
<dt><var>XmlParseError</var>
<dt><var>XmlParseError</var>
<dd>If the method encounters a parsing error,
<dd>If the method encounters a parsing error, properties of the exception object may indicate the location and type of problem. See <var>[[XmlParseError_class|"XMLParseError Exception Class"]]</var>.
properties of the exception object may indicate the location and type of problem.
See [[??]] refid=xmlpars..
</dl>
</dl>


==Usage notes==
==Usage notes==
<ul>
<ul>
<li>See the LoadXml function
<li>See the <var>[[LoadXml (XmlDoc/XmlNode function)|LoadXml]]</var> function.
[[??]] reftxt='Usage Notes' refid=unlxml..
</ul>
</ul>


===Example===
==Examples==
 
<ol><li>
The following [[Janus Web Server]] program uses
The following <var class="product">[[Janus Web Server|"Janus Web Server"]]</var> program uses <var>WebReceive</var> to obtain the XML document from the HTTP request:
<var>WebReceive</var> to obtain the XML document from the HTTP request:
<p class="code">begin
<p class="code">Begin
  %d object xmlDoc
%d Object XmlDoc
  %d = new
%d = New
  %d:webReceive
%d:WebReceive
  %d2 object xmlDoc
%d2 Object XmlDoc
  %d2 = new
%d2 = New
  %d2:[[LoadXml (XmlDoc/XmlNode function)|loadXml]]('<sum>' With -
%d2:LoadXml('<sum>' With -
  %d:[[Value_(XmlDoc/XmlNode_property)|value]]('/*/*[1]') + %d:value('/*/*[2]') -
%d:Value('/*/*[1]') + %d:Value('/*/*[2]') -
      with '</sum>')
  With '</sum>')
  %d2:[[WebSend_(XmlDoc_subroutine)|webSend]]
%d2:WebSend
end
End
</p></ol>
</p>


===Request-Cancellation Errors===
==Request-Cancellation Errors==
<ul>
<ul>
<li><var>XmlDoc</var> is not EMPTY.
<li><var class="term">doc</var> is not EMPTY.
<li><i>Option</i> is invalid.
<li><var class="term">options</var> is invalid.
<li>Insufficient free space exists in CCATEMP.
<li>Insufficient free space exists in CCATEMP.
<li>A syntax error occurred in the
<li>A syntax error occurred in the text string representation of the XML document (these are tolerated if the <var class="term">ErrRet</var> option is specified).
text string representation of the XML document
(these are tolerated if the ERRRET option is specified).
</ul>
</ul>


==See also==
==See also==
{{Template:XmlDoc:WebReceive footer}}
<ul>
<ul>
<li>If you want to deserialize a string,
<li>If you want to deserialize a string, use <var>[[LoadXml (XmlDoc/XmlNode function)|LoadXml]]</var>.
use ??[[LoadXml (XmlDoc/XmlNode function)|LoadXml]].
<li>The subroutine that serializes an <var>XmlDoc</var> and sends it as a Web response is <var>[[WebSend_(XmlDoc_subroutine)|WebSend]]</var>.
<li>The subroutine that serializes an <var>XmlDoc</var> and sends it as a
Web response is WebSend, described below
in ??[[WebSend (XmlDoc subroutine)|WebSend]].
</ul>
</ul>
{{Template:XmlDoc:WebReceive footer}}

Revision as of 12:03, 16 May 2011

Deserialize Web request into this XmlDoc (XmlDoc class)

[Requires Janus SOAP]

WebReceive converts an HTTP request received on a "Janus Web Server" thread from the text representation of an XML document to an XmlDoc tree (this process is called deserialization, because the text representation of a document is called the serial form). It returns a zero value if the deserialization is successful or a non-zero value if unsuccessful and the ErrRet option is used and the particular error is tolerated.

Syntax

[%errorPosition =] doc:WebReceive[( [formFieldname], [fieldOccurrence], - [options])] Throws XmlParseError

Syntax terms

%errorPosition A %variable set to 0 if the deserialization is successful, or, if the ErrRet option is used, to the position within the uploaded data at which an error is found.
doc An expression that points to the XmlDoc to contain the deserialized representation of the XML document.
formFieldName The name of the form field associated with the "<input type=file>" tag in the HTML form, that is, the value of the "name" parameter in that tag. See the fieldname argument of $Web_Proc_Recv in the "Janus Web Server" reference manual.
fieldOccurrence The number of the form field associated with the "<input type=file>" tag in the HTML form. See the occurrence argument of $Web_Proc_Recv in the "Janus Web Server" reference manual..
options See the options argument of LoadXml.

Exceptions

This function can throw the following exception:

XmlParseError
If the method encounters a parsing error, properties of the exception object may indicate the location and type of problem. See "XMLParseError Exception Class".

Usage notes

Examples

  1. The following "Janus Web Server" program uses WebReceive to obtain the XML document from the HTTP request:

    begin %d object xmlDoc %d = new %d:webReceive %d2 object xmlDoc %d2 = new %d2:loadXml('<sum>' With - %d:value('/*/*[1]') + %d:value('/*/*[2]') - with '</sum>') %d2:webSend end

Request-Cancellation Errors

  • doc is not EMPTY.
  • options is invalid.
  • Insufficient free space exists in CCATEMP.
  • A syntax error occurred in the text string representation of the XML document (these are tolerated if the ErrRet option is specified).

See also

  • If you want to deserialize a string, use LoadXml.
  • The subroutine that serializes an XmlDoc and sends it as a Web response is WebSend.