Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Debugging an OLE service
Message
From
23/08/2007 12:35:51
 
 
To
23/08/2007 12:31:16
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01249928
Message ID:
01249930
Views:
19
You might try the suggestion here

http://www.west-wind.com/presentations/IIS4Com.htm

I've only debugged services in DotNet, so not sure about VFP

>I have a client utility sending data strings to a service created using the following EMPS_Server_Class subclass. I have code in the DataArrival procedure that creates a LOG file whenever it is run. The log file does not get created, though I can tell that the port is open, listening and receiving as the client utility does not error out like it (normally) does if the port isn't actively open. Anyone have any ideas what I can do to debug this? I'm unable to walk through the code as it's a service. Unless there is a way to do that?
>
>
>
>**********************************************************
>DEFINE CLASS EMPS_Class AS SESSION OLEPUBLIC
>
>	IMPLEMENTS DMSWinsockControlEvents IN "c:\windows\system32\mswinsck.ocx"
>
>	oSock = NULL
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_Error(NUMBER AS INTEGER, DESCRIPTION AS STRING, Scode AS NUMBER, SOURCE AS STRING, HelpFile AS STRING, HELPCONTEXT AS NUMBER, CancelDisplay AS LOGICAL) AS VOID HELPSTRING "Error occurred"
>		* add user code here
>
>	ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_DataArrival(bytesTotal AS NUMBER) AS VOID HELPSTRING "Occurs when data has been received from the remote computer"
>
>		*		strData = SPACE(256)  && Define string to pass to GetData
>
>* JJ - TESTING ONLY
>STRTOFILE('DataArrival: ' + DTOS(DATE()) + +CHR(10) + CHR(13),'c:\fmsrun\logfile.log',1)
>
>		THIS.oSock.OBJECT.GETDATA(@strData)
>
>		lnStart = SECONDS()
>		DO WHILE THIS.oSock.State = 6 AND SECONDS() - lnStart <= 5
>			DOEVENTS
>		ENDDO
>
>		IF THIS.oSock.State = 7
>			* Testing code to parse HL7 billing data from Medinotes Client to EM tables
>			=Convert_HL7_Billing_Data(strData)
>		ENDIF
>
>	ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_Connect() AS VOID HELPSTRING "Occurs connect operation is completed"
>		* add user code here
>
>	ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_ConnectionRequest(requestID AS NUMBER) AS VOID HELPSTRING "Occurs when a remote client is attempting to connect"
>
>		#DEFINE sckClosed 0
>
>		IF THIS.OBJECT.State <> sckClosed
>			THIS.oSock.OBJECT.CLOSE
>		ENDIF
>
>		*!* Accept the request with the requestID
>		*!* parameter.
>		THIS.oSock.OBJECT.ACCEPT(requestID)
>
>	ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_Close() AS VOID HELPSTRING "Occurs when the connection has been closed"
>		* add user code here
>
>	ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_SendProgress(bytesSent AS NUMBER, bytesRemaining AS NUMBER) AS VOID HELPSTRING "Occurs during process of sending data"
>		* add user code here
>
>	ENDPROC
>
>
>	**********************************************************
>	PROCEDURE DMSWinsockControlEvents_SendComplete() AS VOID HELPSTRING "Occurs after a send operation has completed"
>		* add user code here
>
>	ENDPROC
>
>
>	**********************************************************
>	PROCEDURE INIT
>
>		THIS.oSock = CREATEOBJECT("MSWinsock.Winsock.1")
>		EVENTHANDLER(THIS.oSock, THIS)
>
>	ENDPROC
>
>ENDDEFINE
>
>
>
>**********************************************************
>DEFINE CLASS EMPS_Server_Class AS EMPS_Class
>
>	**********************************************************
>	PROCEDURE INIT
>
>		DODEFAULT()
>
>*		THIS.oSock.LocalHostName = m.HostName
>		THIS.oSock.LocalPort = m.Port
>		THIS.oSock.Listen()
>		* oSock.SendData("This is a test.")
>
>	ENDPROC
>
>ENDDEFINE
>
>
>
>**********************************************************
>DEFINE CLASS EMPS_Client_Class AS EMPS_Class
>
>	**********************************************************
>	PROCEDURE INIT
>
>		DODEFAULT()
>
>		THIS.oSock.RemoteHost = m.HostName
>		THIS.oSock.RemotePort = m.Port
>		THIS.oSock.Connect()
>		* oSock.SendData("This is a test.")
>
>	ENDPROC
>
>ENDDEFINE
>
>
>
>*******************************************************************************
>PROCEDURE Convert_HL7_Billing_Data
>	*******************************************************************************
>
>	PARAMETERS tInput
>
>	strProcessData = tInput
>
>	* TESTING ONLY
>	* USE "\DATA\Proc_Lock.DBF" IN 0
>
>	IF !USED("Proc_Lock")
>		USE "c:\FMSRun\DATA\Proc_Lock.DBF" IN 0
>	ENDIF
>
>	SELECT Proc_Lock
>
>	IF Proc_Lock.Locked = .T.
>		WAIT WINDOW 'Unable to update HL7 at this time.'
>	ELSE
>
>		SELECT Proc_Lock
>		REPLACE Proc_Lock.Locked WITH .T.
>
>		WAIT WINDOW 'Ready to update HL7...'
>
>		* TESTING ONLY
>		* USE "\DATA\JMJ_IN.DBF" IN 0 AGAIN
>		USE "c:\FMSRun\DATA\JMJ_IN.DBF" IN 0
>
>		*!*	TEXT TO strProcessData NOSHOW
>		*!*	MSH|^~\&|Medinotes|CP|External||20070718121318||DFT^P03|469E3C972923|P|2.4|||AL|||
>		*!*	EVN|P03|20070718121318|20070718121318
>		*!*	PID|1|1001601|464C71FA040D||Cruise^Tom||19650101000000||||||||||||587879879
>		*!*	PV1|1|O|Ambulatory Surgery Center^^^^^^^^Ambulatory Surgery Center||||^Cardio^Full|||||||||||||||||||||||||||||||||||||20070718121318||||||
>		*!*	ORC|SN|
>		*!*	FT1|1|||20070718121318||CG||||||||||^^^Ambulatory Surgery Center|||153.6^Malignant Neoplasm Of Ascending Colon^I9|^Cardio^Full|||||12053^Layer Closure Of Wounds Of Face, Ears, Eyelids, Nose, Lips And/Or Mucous Membranes; 5.1 cm To 7.5 cm^C4|
>		*!*	DG1|1||153.6^Malignant Neoplasm Of Ascending Colon^I9|||F
>		*!*	MSH|^~\&|Medinotes|CP|External||20070705154008||DFT^P03|468D4AD320F3|P|2.4|||AL|||
>		*!*	EVN|P03|20070705154008|20070705154008
>		*!*	PID|1|11384|468AE48A7926||Johengen^Neil||20051108000000||||||||||||
>		*!*	PV1|1|O|Ambulatory Surgery Center^^^^^^^^Ambulatory Surgery Center||||^Cardio^Full|||||||||||||||||||||||||||||||||||||20070705154008||||||
>		*!*	ORC|SN|
>		*!*	FT1|1|||20070705154008||CG||||||||||^^^Ambulatory Surgery Center|||250.00^Diabetes Mellitus Without Mention Of Complication, Type II Or Unspecified Type, Not Stated As Uncontrolled^I9|^Cardio^Full|||||99212^Office Or Other Outpatient Visit For The Evaluation And Management Of An Established Patient, Which Requires At Least Two Of These Three Key Components: A Problem Focused History; A Problem Focused Examination; Straightforward Medical Decision Making. Counseling And/Or Coordination Of Care With Other Providers Or Agencies Are Provided Consistent With The Nature Of The Problem(s) And The Patient's And/Or Family's Needs. Usually, The Presenting Problem(s) Are Self Limited Or Minor. Physicians Typically Spend 10 Minutes Face-To-Face With The Patient And/Or Family.^C4|
>		*!*	DG1|1||250.00^Diabetes Mellitus Without Mention Of Complication, Type II Or Unspecified Type, Not Stated As Uncontrolled^I9|||F
>		*!*	ENDTEXT
>
>		m.MessageCount = 0
>		m.MessageLineCount = 0
>
>		m.FirstMessage = .T.
>
>		FOR ix=1 TO ALINES(laLines,strProcessData)
>
>			STORE LineToObject(laLines[m.ix]) TO ('loObj'+LTRIM(STR(m.ix)))
>			m.Segment = ALLTRIM(UPPER(EVALUATE('loObj'+LTRIM(STR(m.ix))+".Segment")))
>			DO CASE
>				CASE m.Segment = 'MSH'
>					SELECT JMJ_IN
>					APPEND BLANK
>					m.MessageCount = m.MessageCount + 1
>					m.MessageLineCount = 1
>					WITH EVALUATE('loObj'+TRANSFORM(m.ix))
>						REPLACE JMJ_IN.CODE WITH ALLTRIM(UPPER(.Segment))
>					ENDWITH
>					IF m.FirstMessage = .T.
>						m.FirstMessage = .F.
>					ELSE
>						* JUST FOR TESTING - Real call will send concantenated variable
>						* Send ACK for all messages except the final one
>						m.Acknowledgement = "MSH|^~\&|Medinotes e||||20070810113347||"
>						m.Acknowledgement = m.Acknowledgement + "ACK|20070214102554000008|P|2.4|||||||"
>						m.Acknowledgement = m.Acknowledgement + "MSA|AA|20070214102554000008||||"
>						=Acknowledgement(m.Acknowledgement)
>					ENDIF
>				CASE m.Segment = 'EVN'
>					m.MessageLineCount = m.MessageLineCount + 1
>				CASE m.Segment = 'PID'
>					m.MessageLineCount = m.MessageLineCount + 1
>					WITH EVALUATE('loObj'+TRANSFORM(m.ix))
>						REPLACE JMJ_IN.Pat_No WITH ALLTRIM(UPPER(.Field002))
>					ENDWITH
>				CASE m.Segment = 'PV1'
>					m.MessageLineCount = m.MessageLineCount + 1
>				CASE m.Segment = 'ORC'
>					m.MessageLineCount = m.MessageLineCount + 1
>				CASE m.Segment = 'FT1'
>					m.MessageLineCount = m.MessageLineCount + 1
>					WITH EVALUATE('loObj'+TRANSFORM(m.ix))
>						REPLACE JMJ_IN.Raw_Date WITH ALLTRIM(UPPER(.Field004))
>						REPLACE JMJ_IN.Charge WITH VAL(.Field011)
>						REPLACE JMJ_IN.Units WITH VAL(.Field012)
>						REPLACE JMJ_IN.Diag1 WITH LEFT(ALLTRIM(UPPER(.Field019)),AT('^',.Field019)-1)
>						REPLACE JMJ_IN.PROC WITH LEFT(ALLTRIM(UPPER(.Field025)),AT('^',.Field025)-1)
>					ENDWITH
>				CASE m.Segment = 'DG1'
>					m.MessageLineCount = m.MessageLineCount + 1
>				OTHERWISE
>					m.MessageLineCount = m.MessageLineCount + 1
>			ENDCASE
>
>			=AMEMBERS(gaPropArray, EVALUATE('loObj'+LTRIM(STR(m.ix))), 1)  && Array containing object properties
>			FOR iFields = 1 TO EVALUATE('loObj'+LTRIM(STR(m.ix))+".FieldCount")
>				* ? gaPropArray(iFields,1)
>			ENDFOR
>
>			IF m.MessageCount > 0
>				* WAIT WINDOW 'Store Segment Now'
>				* CLEAR
>			ENDIF
>
>		ENDFOR
>
>		* JUST FOR TESTING - Real call will send concantenated variable
>		* Send ACK for last message processed
>		=Acknowledgement(m.Acknowledgement)
>
>		SELECT Proc_Lock
>		REPLACE Proc_Lock.Locked WITH .F.
>
>		USE IN JMJ_IN
>		USE IN Proc_Lock
>
>	ENDIF
>
>	RETURN .T.
>	*******************************************************************************
>
>
>
>	*******************************************************************************
>PROCEDURE Acknowledgement(tcACK)
>	*******************************************************************************
>
>	* Send ACK back to HL7 Client
>	IF THISFORM.tcpServer.OBJECT.State = 7
>		THISFORM.tcpServer.OBJECT.SendData(tcACK)
>	ELSE
>		WAIT WINDOW "Not Connected." TIMEOUT 1
>		* Need to log this to say that the acknowledgement was not sent
>	ENDIF
>
>	RETURN .T.
>	*******************************************************************************
>
>
>
>	*******************************************************************************
>PROCEDURE LineToObject(tcLine)
>	*******************************************************************************
>
>	LOCAL loRecord,ix
>
>	loRecord = CREATEOBJECT('Empty')
>
>	ADDPROPERTY(loRecord, 'Segment', GETWORDNUM( m.tcLine,1,'|'))
>
>	m.FieldCount = 0
>
>	FOR ix=1 TO OCCURS('|',m.tcLine)
>		m.Stepper = 0
>		IF ix = 1 AND loRecord.Segment = 'MSH'
>			ADDPROPERTY(loRecord, 'Field001', '|')
>			m.FieldCount = m.FieldCount + 1
>			m.Stepper = 1
>		ENDIF
>		ADDPROPERTY(loRecord, 'Field'+PADL(m.ix+m.Stepper,3,'0'), STREXTRACT(m.tcLine,'|','|',m.ix,2))
>		m.FieldCount = m.FieldCount + 1
>	ENDFOR
>
>	ADDPROPERTY(loRecord, 'FieldCount', m.FieldCount)
>
>	RETURN loRecord
>
>ENDPROC
>*******************************************************************************
>
Previous
Reply
Map
View

Click here to load this message in the networking platform