XML Replay: Difference between revisions
From DataFlex Wiki
Jump to navigationJump to search
→Replaying Logged XML
No edit summary |
|||
Line 25: | Line 25: | ||
In order to do this however, you are going to need a client which operates at a lower level than the standard web service client class you are able to generate for your service. The following is an example of how you might do this. | In order to do this however, you are going to need a client which operates at a lower level than the standard web service client class you are able to generate for your service. The following is an example of how you might do this. | ||
Object oTfr is a cXmlHttpTransfer | |||
End_Object // oTfr | |||
Procedure InvokeService | |||
Handle hoXML hoXmlResponse hoEnv hoBody hoDoc hoMsg | |||
Boolean bOK | |||
String sServer sURI | |||
Integer iTarg | |||
Get Create U_cXmlDomDocument to hoDoc | |||
Set psDocumentName of hoDoc to (Value(oInput(Self))) | |||
Get LoadXmlDocument of hoDoc to bOK | |||
If not bOK Begin | |||
Error 0 ("Could not load document" * psDocumentName(hoDoc)) | |||
Procedure_Return | |||
End | |||
Get DocumentElement of hoDoc to hoMsg | |||
Get Create U_cXmlDomDocument to hoXML | |||
Send AddChildProcessingInstruction of hoXML "xml" 'version="1.0"' // encoding="utf-8"' | |||
Get CreateDocumentElementNS of hoXML "http://schemas.xmlsoap.org/soap/envelope/" "soap:Envelope" to hoEnv | |||
Get AddElement of hoEnv "soap:Body" "" to hoBody | |||
Get AppendNode of hoBody hoMsg to hoMsg | |||
Send ClearHeaders of oTfr | |||
Set psAcceptTypes of oTfr to "text/*" | |||
Set psContentTypeSent of oTfr to "text/xml; charset=UTF-8" | |||
Get AddHeader of oTfr "SOAPAction" ('"' + Value(oOperation(Self)) + '"') to bOk | |||
Get Value of oServer to sServer | |||
Get Value of oURI to sURI | |||
Set piRemotePort of oTfr to (Value(oPort(Self))) | |||
Get HttpPostXmlNode of oTfr sServer sURI hoXML to hoXMLResponse | |||
If (hoXmlResponse=0) Set Value of oReturnedXML to "NO RESPONSE" | |||
Else Set Value of oReturnedXML to (psXml(hoXmlResponse)) | |||
Send Destroy of hoXML | |||
If hoXMLResponse Send Destroy of hoXMLResponse | |||
End_Procedure // InvokeService |