Skip to content

HttpPostXmlNode - cXmlHttpTransfer

Posts and receives XML data via XML object nodes

Type: Function
Return Data Type: Handle

Parameters

Parameter Type Description
sHost String The URL host (e.g. DataAccess.com - Note: DO NOT include the "HTTP://")
sFilePath String The file path and any data passed in a query string (e.g. MyXMlSite/XmlSrvc.asp?ID=A)
hoXmlNode Handle A valid XML node

Syntax

Function HttpPostXmlNode String sHost String sFilePath Handle hoXmlNode Returns Handle

Call Example

Get HttpPostXmlNode sHost sFilePath hoXmlNode to HandleVariable

Description

The HttpPostXmlNode function posts and receives XML data via XML object nodes. The data to be posted is passed as an XML DOM object. The data received is returned as a new XML object. If an error occurs in the transfer or if the resulting data is not properly formed XML, a zero is returned.

This along with HttpGetXmlNode, will be the two most commonly used methods in this class.

Both posted and received data is translated as needed based on the values of peTranslateSent and peTranslateReceived.

If successful, this method returns a handle to a newly created XML DOM document based on the cXmlDomDocument class. It becomes the programmer's responsibility to properly destroy this object when it is no longer needed. You do this by sending the destroy message of the object handle.

Sample

handle hoHttp
handle hoSentXml
handle hoRcvdXml
integer bOk

// create Xml document to post. Create document and load from local disk

Get Create U_cXmlDomDocument to hoSentXml

Set psDocumentName of hoSentXml to "d:\MyData\MyXmlData.xml"

Send LoadXmlDocument of hoSentXml to bOk

if (bOk=True) begin
    // Create xmlHttp transfer object.
    Get Create U_cXmlHttpTransfer to hoHttp

    // Post xml document and receive returned Xml document
    Get HttpPostXmlNode of hoHttp "dataaccess.com" ;
        "MyApplication/XmlService.asp" hoSentXml to hoRcvdXml

    Send Destroy of hoHttp // transfer object no longer needed

    If (hoRcvdXml=0) ;
         Send Stop_Box "No document returned" "Error"
    else begin
        send Info_Box (psXml(hoRcvdXml))
        send DoWhateverYouWantWithXmlDocument hoRcvdXml

        Send Destroy of hoRcvdXml
    end
end

Send Destroy of hoSentXml

See Also

Info_Box | Stop_Box

Return Value

The data received is returned as a new XML object. If an error occurs in the transfer or if the resulting data is not properly formed XML, a zero is returned.