WebReceive (XmlDoc function): Difference between revisions

From m204wiki
Jump to navigation Jump to search
m (1 revision)
m (1 revision)
Line 4: Line 4:
converts an HTTP request received on a [[Janus Web Server]] thread from the text
converts an HTTP request received on a [[Janus Web Server]] thread from the text
representation of an
representation of an
XML document to an XmlDoc tree (this process is called '''deserialization''',
XML document to an <var>XmlDoc</var> tree (this process is called '''deserialization''',
because the text representation of a document is called the '''serial'''
because the text representation of a document is called the '''serial'''
form).
form).
Line 17: Line 17:
<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 ErrRet 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 XmlDoc 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>fldNam</th>
<tr><th>fldNam</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 "fieldname" argument of $Web_Proc_Recv in the &JANWEBR.. </td></tr>
Line 30: Line 30:
This function can throw the following exception:
This function can throw the following exception:
<dl>
<dl>
<dt>XmlParseError
<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.
properties of the exception object may indicate the location and type of problem.
Line 46: Line 46:


The following [[Janus Web Server]] program uses
The following [[Janus Web Server]] program uses
WebReceive 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 <var>Object</var> <var>XmlDoc</var>
%d = New
%d = New
%d:WebReceive
%d:<var>WebReceive</var>
%d2 Object XmlDoc
%d2 <var>Object</var> <var>XmlDoc</var>
%d2 = New
%d2 = New
%d2:LoadXml('<sum>' With -
%d2:LoadXml('<sum>' With -
Line 62: Line 62:
===Request-Cancellation Errors===
===Request-Cancellation Errors===
<ul>
<ul>
<li>XmlDoc is not EMPTY.
<li><var>XmlDoc</var> is not EMPTY.
<li><i>Option</i> is invalid.
<li><i>Option</i> is invalid.
<li>Insufficient free space exists in CCATEMP.
<li>Insufficient free space exists in CCATEMP.
Line 77: Line 77:
<li>If you want to deserialize a string,
<li>If you want to deserialize a string,
use ??[[LoadXml (XmlDoc/XmlNode function)|LoadXml]].
use ??[[LoadXml (XmlDoc/XmlNode function)|LoadXml]].
<li>The subroutine that serializes an XmlDoc and sends it as a
<li>The subroutine that serializes an <var>XmlDoc</var> and sends it as a
Web response is WebSend, described below
Web response is WebSend, described below
in ??[[WebSend (XmlDoc subroutine)|WebSend]].
in ??[[WebSend (XmlDoc subroutine)|WebSend]].
</ul>
</ul>

Revision as of 17:46, 25 January 2011

Deserialize Web request into this XmlDoc (XmlDoc class)

[Requires Janus SOAP]


This callable function 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

%pos 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.
fldNam 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..
fldOcc 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..
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 ?? refid=xmlpars..

Usage notes

  • See the LoadXml function ?? reftxt='Usage Notes' refid=unlxml..

Example

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

  • XmlDoc is not EMPTY.
  • Option 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, described below in ??WebSend.