Skip to content

HttpPostXmlAddr - cXmlHttpTransfer

Posts and receives XML data as pointers

Type: Function
Return Data Type: Pointer

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)
pXml Pointer
iLen Integer The length of the XML string

Syntax

Function HttpPostXmlAddr String sHost String sFilePath Pointer pXml Integer iLen Returns Pointer

Call Example

Get HttpPostXmlAddr sHost sFilePath pXml iLen to PointerVariable

Description

The HttpPostXMLAddr function posts and receives XML data as pointers. The data received is returned via pointer addresses. It is assumed that the posted data will be zero terminated. The returned data, if translated, will be zero terminated and it is assumed that the returned data is zero terminated. If an error occurs in the transfer or if there is no resulting data, a zero is returned. The returned data does not have to be a valid XML document. It is up to you to dispose of the returned data using the free function.

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

Sample

Procedure Example
    Handle hoHttp hoXML
    String sXML
    Address aSentXML aRcvdXML
    Integer iLen iVoid
    Boolean bOk

    Move "<customer><c1>test</c1><c1>test2</c1><c1>test3</c1></customer>" to sXML
    Move (Length(sXML)) to iLen
    Move (AddressOf(sXML)) to aSentXML

    // Create XMLHttp transfer object.

    // Post XML document and receive returned XML string

    Get Create U_cXMLHttpTransfer to hoHttp

    Get HttpPostXMLAddr of hoHttp "dataaccess.com" ;
        "MyApplication/XMLService.asp" aSentXML iLen to aRcvdXML

    Send Destroy of hoHttp

    If (aRcvdXML=0) ;
        Send Stop_Box "No document returned" "Error"
    Else Begin
        Get Create U_cXMLDomDocument to hoXML

        Get LoadXMLFromAddress of hoXML aRcvdXML to bOk

        Move (Free(aRcvdXML)) to iVoid

        If (bOk=True) ;
            Send DoWhateverYouWantWithXMLDocument hoXML

        Send Destroy of hoXML
    End
End_Procedure

Return Value

The data received is returned via pointer addresses.