Hola FiveWinners
Anyone know where I can find NG for xHarbour?
Regards
//the func below will create an x12-270 hipaa message and will connect to
//the clearinghouse webservice to find the patient's eligibility for the
//medical service being rendered.
FUNCTION FindClmEligibility( cClaimKey, isSilent )
LOCAL oImWs
LOCAL cFileName, cRet
...
oImWs := InmediataWs():InitRealTime( oApp():oMeter )
IF oImWs == NIL ;RETURN NIL ;ENDIF
oImWs:isSilent := isSilent
oImWs:cMessage := MemoRead( cFileName )
oImWs:SendRealTimeMessage()
cRet := oImWs:cResponse
oImWs:End()
...
//---------------------------------------------------------------------------
METHOD InitRealTime( oMeter ) CLASS InmediataWs
LOCAL isLogHttpProgress := GetValFromRepository( "X12WebService", "LogProgress", "NO" ) $ "YES,.T., TRUE,Y"
LOCAL nTimeOut := VAL( GetValFromRepository( "X12WebService", "TimeOut", "30000", "Timeout in milliseconds" ) )
LOCAL cUserName:= GetValFromRepository( "X12WebService", "UserName", "Name" )
LOCAL cPassword:= GetValFromRepository( "X12WebService", "Password", "Passwrd" )
LOCAL cUrl := GetValFromRepository( "X12WebService", "RealTime_Eligibility_Url", ;
'https://www.inmediata.com/webservices/editransfer/edirealtime.asmx' )
TRY
::oHttp := tIPClientHTTP():new( cUrl, isLogHttpProgress )
CATCH
MsgStop( "Missing SSL libs or no access to https was found.", "Check Installation" )
RETURN NIL
END
IF ::oHttp == NIL ;RETURN NIL ;ENDIF
::oHttp:nConnTimeOut := nTimeOut
::cUserName := cUserName
::cPassword := cPassword
::oMeter := oMeter
IF ::oMeter != NIL
::oMeter:nTotal := 100
::oMeter:Show()
::oHTTP:exGauge := { | nAt, nTotal, oSelf| ::oMeter:Set( ( Max( nAt, 0.00001 ) / Max( nTotal, 0.00001 ) ) * 100 ) }
ENDIF
IF ::oHttp:open()
::oHttp:hFields[ 'Content-Type'] := 'application/soap+xml; charset=utf-8'
RETURN SELF
ENDIF
RETURN NIL
//---------------------------------------------------------------------------
METHOD SendRealTimeMessage() CLASS InmediataWs
LOCAL cPost
cPost := ;
'<?xml version="1.0" encoding="utf-8"?>'+;
'<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">'+;
' <soap12:Header>'+;
' <AuthenticationHeader xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
' <Username>' + ::cUserName + '</Username>'+;
' <Password>' + ::cPassword + '</Password>'+;
' </AuthenticationHeader>'+;
' </soap12:Header>'+;
' <soap12:Body>'+;
' <SendRealTime xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
' <X12Data>' + ::cMessage + '</X12Data>'+;
' </SendRealTime>'+;
' </soap12:Body>'+;
'</soap12:Envelope>'
IF ::oHttp:Post( cPost ) ;::GetRealTimeMessage() ;ENDIF
RETURN NIL
//---------------------------------------------------------------------------
METHOD GetRealTimeMessage() CLASS InmediataWs
LOCAL oXmlDoc := TXmlDocument():New()// HBXML_STYLE_NOESCAPE )
LOCAL cResponse
LOCAL oXmlNode, cRet
cResponse := ::oHttp:ReadAll()
oXmlDoc:Read( cResponse )
oXmlNode := oXmlDoc:FindFirst( "RealTimeResponse" )
IF oXmlNode != NIL ;cRet := oXmlNode:cData ;ENDIF
oXmlNode := NIL
oXmlDoc := NIL
::cResponse := cRet
RETURN cRet
*-------------------------------------------------------------------------------------------------------------------------------
//function getValFromRepository is a replacement for Tini class, where values can be saved as a variable name
//under a given section. The difference is that all these values are stored into a .dbf table instead of a text file.
//
//Some unrelated code has been removed to aid in clarity.
//
FUNCTION FindPteEligibility( cRecNo, cContract, cIns, isSilent )
LOCAL cUserName:= GetValFromRepository( “X12WebService", "UserName", "psswrd" )
LOCAL cPassword:= GetValFromRepository( “X12WebService", "Password", "usrname" )
LOCAL cUrl := GetValFromRepository( "X12WebService", "RealTime_Eligibility_Url", ;
'https://www.inmediata.com/webservices/editransfer/edirealtime.asmx' )
LOCAL oImWs
LOCAL cFileName, cRet
LOCAL isCreated := .F.
LOCAL o270 := t270():New()
DEFAULT isSilent := .F.
…
oImWs := InmediataWs():InitRealTime()
IF oImWs == NIL ;RETURN NIL ;ENDIF
oImWs:isSilent := isSilent
oImWs:cMessage := MemoRead( cFileName )
oImWs:SendRealTimeMessage()
cRet := oImWs:cResponse
oImWs:End()
ferase( cFileName )
RETURN cRet
//---------------------------------------------------------------------------
CLASS InmediataWs
DATA aFiles AS ARRAY INIT {}
DATA aRoutedFiles AS ARRAY INIT {}
DATA aResponse AS ARRAY INIT {}
DATA aRespPages AS ARRAY INIT {}
DATA cUserName, cPassword
DATA cMessage, cResponse
DATA lShowProgress INIT .F.
DATA lShowConnected INIT .F.
DATA isSilent INIT .F.
DATA oHttp, oXml, oMeter
METHOD InitRealTime()
METHOD InitFileTransfer()
METHOD End()
METHOD SendFiles()
METHOD GetResponse()
METHOD GetRoutedFiles()
METHOD SendRealTimeMessage()
METHOD GetRealTimeMessage()
END CLASS
//---------------------------------------------------------------------------
METHOD InitRealTime( oMeter ) CLASS InmediataWs
LOCAL isLogHttpProgress := GetValFromRepository( "X12WebService", "LogProgress", "NO" ) $ "YES,.T., TRUE,Y"
LOCAL nTimeOut := VAL( GetValFromRepository( "X12WebService", "TimeOut", "30000", "Timeout in milliseconds" ) )
LOCAL cUserName:= GetValFromRepository( "X12WebService", "UsrName", "" )
LOCAL cPassword:= GetValFromRepository( “X12WebService", "Password", "Passwrd" )
LOCAL cUrl := GetValFromRepository( "X12WebService", "RealTime_Eligibility_Url", ;
'https://www.inmediata.com/webservices/editransfer/edirealtime.asmx' )
TRY
//TIPClientHttp() is an xharbour native http client class maintained by Rafael Culik <culikr@gmail.com>
//The class inherits from xharbour native class TClient()
::oHttp := tIPClientHTTP():new( cUrl, isLogHttpProgress )
CATCH
MsgStop( "Missing SSL libs or no access to https was found.", "Check Installation" )
RETURN NIL
END
IF ::oHttp == NIL ;RETURN NIL ;ENDIF
::oHttp:nConnTimeOut := nTimeOut
::cUserName := cUserName
::cPassword := cPassword
::oMeter := oMeter
IF ::oMeter != NIL
::oMeter:nTotal := 100
::oMeter:Show()
::oHTTP:exGauge := { | nAt, nTotal, oSelf| ::oMeter:Set( ( Max( nAt, 0.00001 ) / Max( nTotal, 0.00001 ) ) * 100 ) }
ENDIF
IF ::oHttp:open()
::oHttp:hFields[ 'Content-Type'] := 'application/soap+xml; charset=utf-8'
RETURN SELF
ENDIF
RETURN NIL
//---------------------------------------------------------------------------
//The xml tree below could have been created using xharbour TXMLDocument() class
//I find it easier to simply copy the text from the .asmx page and just replace
//with the data I wish to send.
METHOD SendRealTimeMessage() CLASS InmediataWs
LOCAL cPost
cPost := ;
'<?xml version="1.0" encoding="utf-8"?>'+;
'<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">'+;
' <soap12:Header>'+;
' <AuthenticationHeader xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
' <Username>' + ::cUserName + '</Username>'+;
' <Password>' + ::cPassword + '</Password>'+;
' </AuthenticationHeader>'+;
' </soap12:Header>'+;
' <soap12:Body>'+;
' <SendRealTime xmlns="https://www.inmediata.com/ws/EdiRealTime/">'+;
' <X12Data>' + ::cMessage + '</X12Data>'+;
' </SendRealTime>'+;
' </soap12:Body>'+;
'</soap12:Envelope>'
IF ::oHttp:Post( cPost ) ;::GetRealTimeMessage() ;ENDIF
RETURN NIL
//---------------------------------------------------------------------------
METHOD GetRealTimeMessage() CLASS InmediataWs
LOCAL oXmlDoc := TXmlDocument():New()// HBXML_STYLE_NOESCAPE )
LOCAL cResponse
LOCAL oXmlNode, cRet
cResponse := ::oHttp:ReadAll()
oXmlDoc:Read( cResponse ) //Using native xharbour TXMLDocument() class to parse the xml tree.
oXmlNode := oXmlDoc:FindFirst( "RealTimeResponse" )
IF oXmlNode != NIL ;cRet := oXmlNode:cData ;ENDIF
oXmlNode := NIL
oXmlDoc := NIL
::cResponse := cRet
RETURN cRet
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: No registered users and 96 guests