XML Replay: Difference between revisions

From DataFlex Wiki
Jump to navigationJump to search
162 bytes added ,  5 November 2007
m
no edit summary
mNo edit summary
mNo edit summary
Line 42: Line 42:
       End<br />
       End<br />
       Get DocumentElement of hoDoc to hoMsg<br />
       Get DocumentElement of hoDoc to hoMsg<br />
       // Create the SOAP message, adding the initial processing instruction,
       <font color="green">// Create the SOAP message, adding the initial processing instruction,
       // the "Envelope" document element, the "Body", then append your XML to that:
       // the "Envelope" document element, the "Body", then append your XML to that:</font>
       Get Create U_cXmlDomDocument to hoXML
       Get Create U_cXmlDomDocument to hoXML
       Send AddChildProcessingInstruction of hoXML "xml" 'version="1.0"'
       Send AddChildProcessingInstruction of hoXML "xml" 'version="1.0"'
Line 49: Line 49:
       Get AddElement of hoEnv "soap:Body" "" to hoBody
       Get AddElement of hoEnv "soap:Body" "" to hoBody
       Get AppendNode of hoBody hoMsg to hoMsg<br />
       Get AppendNode of hoBody hoMsg to hoMsg<br />
       // Set up the HTTP headers:
       <font color="green">// Set up the HTTP headers:</font>
       Send ClearHeaders of oTfr
       Send ClearHeaders of oTfr
       Set psAcceptTypes of oTfr to "text/*"
       Set psAcceptTypes of oTfr to "text/*"
       Set psContentTypeSent of oTfr to "text/xml; charset=UTF-8"
       Set psContentTypeSent of oTfr to "text/xml; charset=UTF-8"
       Get AddHeader of oTfr "SOAPAction" ('"' + Value(oOperation(Self)) + '"') to bOk<br />
       Get AddHeader of oTfr "SOAPAction" ('"' + Value(oOperation(Self)) + '"') to bOk<br />
       // Prepare the transfer object for sending:
       <font color="green">// Prepare the transfer object for sending:</font>
       Get Value of oServer to sServer
       Get Value of oServer to sServer
       Get Value of oURI    to sURI
       Get Value of oURI    to sURI
       Set piRemotePort of oTfr to (Value(oPort(Self)))<br />
       Set piRemotePort of oTfr to (Value(oPort(Self)))<br />
       // Send the message:
       <font color="green">// Send the message:</font>
       Get HttpPostXmlNode of oTfr sServer sURI hoXML to hoXMLResponse<br />
       Get HttpPostXmlNode of oTfr sServer sURI hoXML to hoXMLResponse<br />
       // Deal with the response:
       <font color="green">// Deal with the response:</font>
       If (hoXmlResponse=0) Set Value of oReturnedXML to "NO RESPONSE"
       If (hoXmlResponse=0) Set Value of oReturnedXML to "NO RESPONSE"
       Else                Set Value of oReturnedXML to (psXml(hoXmlResponse))<br />
       Else                Set Value of oReturnedXML to (psXml(hoXmlResponse))<br />
       // Tidy up:
       <font color="green">// Tidy up:</font>
       Send Destroy of hoXML
       Send Destroy of hoXML
       If hoXMLResponse Send Destroy of hoXMLResponse<br />
       If hoXMLResponse Send Destroy of hoXMLResponse<br />

Navigation menu