|
Submits XML formatted data to the server and returns the result in
a buffer provided by the caller.
Syntax
object.PostXml( Resource, XmlData,
Buffer, [Options] )
Parameters
- Resource
- A string that specifies the resource that the data will be
posted to on the server. Typically this is the name of an
executable script.
- XmlData
- A string that contains the XML formatted data which will be
provided to the script.
- Buffer
- A string or byte array that will contain the output generated
by the script. Typically this is HTML content which is generated by
the script as a result of processing the data that was posted to
it.
- Options
- An optional integer value which specifies one or more options.
This argument is constructed by using a bitwise operator with any
of the following values:
Value |
Constant |
Description |
0 |
httpPostDefault |
The default post mode. The contents of the buffer are
encoded and sent as standard form data. The data returned by
the server is copied to the result buffer exactly as it is
returned from the server. |
1 |
httpPostConvert |
If the data being returned from the server is textual, it
is automatically converted so that the end of line character
sequence is compatible with the Windows platform. Individual
carriage return or linefeed characters are converted to
carriage return/linefeed character sequences. Note that this
option does not have any effect on the form data being
submitted to the server, only on the data returned by the
server. |
4 |
httpPostErrorData |
This option causes the client to accept error data from the
server if the request fails. If this option is specified, an
error response from the server will not cause the method to
fail. Instead, the response is returned to the client and the
method will succeed. |
Return Value
A value of zero is returned if the operation was successful,
otherwise a non-zero error code is returned which indicates the cause
of the failure.
Remarks
The PostXml method is used to submit XML formatted data to
a script that executes on the server and then copy the output from
that script into a local buffer. This function automatically sets the
correct content type and encoding required for submitting XML data to
a server, however it does not parse the XML data itself to ensure
that it is well-formed. Your application is responsible for ensuring
that the XML data that is being submitted to the server is formatted
correctly.
It is common for servers to return additional information about a
failed request in their response to the client. If you need to process
this information, use the httpPostErrorData option which
causes the error message to be returned in the Buffer provided
by the caller. If this option is used, your application should check the
value of the ResultCode property to obtain the HTTP status code
returned by the server. This will enable you to determine if the
operation was successful.
This method will cause the current thread to block until the
operation completes, a timeout occurs or the post is canceled. During
the operation, the OnProgress event will fire periodically,
enabling the application to update any user interface objects such as
a progress bar.
See Also
GetData Method,
GetFile Method,
PostData Method,
PostFile Method,
PostJson Method,
PutData Method,
PutFile Method,
OnProgress Event
|
|