* Create Objects _SCREEN.ADDPROPERTY("oXML") _SCREEN.oXML = CREATEOBJECT("Microsoft.XMLHTTP") _SCREEN.ADDPROPERTY("oXMLDoc") _SCREEN.oXMLDoc = CREATEOBJECT('msxml.domdocument') * Setup Authenticaton Variables * Concantenated User Name and Password cBuffer = lcUserName + ':' + lcPassword * Base64 Encoding cEncoded = STRCONV(cBuffer,13) * cDecoded = STRCONV(cEncoded,14) * Define Authentication String cAuthenticate = "Basic " + cEncoded * SubmitRequest TextRequestMessage = 'The actual message sent to the server goes here.' * Build the submitRealtimeRequestXML manually. The TextRequestMessage variable is inserted into this XML. TEXT TO submitRealtimeRequestHeader NOSHOW PRETEXT 7 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:submitRealtimeRequest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:realtime"> <request xsi:type="xsd:string"> ENDTEXT TEXT TO submitRealtimeRequestFooter NOSHOW PRETEXT 7 </request> </ns1:submitRealtimeRequest> </soapenv:Body> </soapenv:Envelope> ENDTEXT * Create the XML message manually and save it for debugging submitRealtimeRequestXML = submitRealtimeRequestHeader + TextRequestMessage + submitRealtimeRequestFooter * STRTOFILE(submitRealtimeRequestXML,"c:\temp\submitRealtimeRequestXML.txt") * Open POST _SCREEN.oXML.OPEN("POST", lcURL, .F.) * Set Headers _SCREEN.oXML.setRequestHeader("Content-Type","application/x-www-form-urlencoded") _SCREEN.oXML.setRequestHeader("SOAPAction", "''") _SCREEN.oXML.setRequestHeader("authorization", cAuthenticate) TRY _SCREEN.oXML.SEND(submitRealtimeRequestXML) submitRealtimeRequestMessage = _SCREEN.oXML.ResponseText CATCH TO oCatch TSHIdentifier = '' ENDTRY IF TYPE('oCatch') <> 'O' X12Message = ConvertXML('Request',submitRealtimeRequestMessage) TSHIdentifier = X12Message RETURN .T. ELSE RETURN .F. ENDIF * Pull Response * Build the pullRealtimeResponseXML manually. The TextRequestMessage variable is inserted into this XML. TEXT TO pullRealtimeResponseHeader NOSHOW PRETEXT 7 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <ns1:pullRealtimeResponse soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns1="urn:realtime"> <request xsi:type="xsd:string"> ENDTEXT TEXT TO pullRealtimeResponseFooter NOSHOW PRETEXT 7 </request> </ns1:pullRealtimeResponse> </soapenv:Body> </soapenv:Envelope> ENDTEXT * Create the XML message manually and save it for debugging pullRealtimeResponseXML = pullRealtimeResponseHeader + TSHIdentifier + pullRealtimeResponseFooter * STRTOFILE(pullRealtimeResponseXML,"c:\temp\pullRealtimeResponseXML.txt") * Open POST _SCREEN.oXML.OPEN("POST", lcURL, .F.) * Set Headers _SCREEN.oXML.setRequestHeader("Content-Type","application/x-www-form-urlencoded") _SCREEN.oXML.setRequestHeader("SOAPAction", "''") _SCREEN.oXML.setRequestHeader("authorization", cAuthenticate) _SCREEN.oXML.SEND(pullRealtimeResponseXML) pullRealtimeResponseMessage = _SCREEN.oXML.ResponseText