Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Dilbert a day webservice
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00721272
Message ID:
00721457
Views:
10
I just hacked it a bit to use SYS() to store the file on the TMPFILES= path.
Also since what's returned has a GIF89a header, I changed the extension to .GIF
*-------------------------------------------------------------------------
*
* Description: Display a Dilbert cartoon on the desktop. Dilbert-A-Day!
*
*
*
*--------------------------------------------------------------------------
*
* Author: Paul Mrozowski
*
* Copyright (C) 2002 - All Rights Reserved.
*     Paul Mrozowski
*     Kirtland Associates, Inc.
*     1220 Morse, Suite 200
*     Royal Oak, MI 48067
*
*--------------------------------------------------------------------------
*
*              C H A N G E    L O G 
*
*   Date       Dev    System             WO/Description
* ----------- ------ -----------  --------------------------------------
*  11/11/2002  PCM
*  11/11/2002  PAM                 Use TEMP files setting and save as .GIF
*
*--------------------------------------------------------------------------
LOCAL loWSDailyDilbert AS "XML Web Service"
* Do not remove or alter following line. It is used to support IntelliSense for your XML Web service.
*__VFPWSDef__: loWSDailyDilbert = http://www.esynaps.com/WebServices/DailyDiblert.asmx?WSDL , DailyDilbert , DailyDilbertSoap
LOCAL laFile[1]

IF FILE(HOME() + "Dilbert.bmp")
   ADIR(laFile, HOME() + "Dilbert.bmp")
   IF VARTYPE(laFile[3]) = "D"
      IF laFile[3] < DATE()
         GetDilbert()
      ENDIF
   ENDIF
ELSE
   * The file doesn't exist, let's go get it
   GetDilbert()
ENDIF

DisplayDilbert()

FUNCTION GetDilbert()
LOCAL loException, ;
      loWSHandler, ;
      lcBinary

	TRY
		loWSHandler = NEWOBJECT("WSHandler",IIF(VERSION(2)=0,"",HOME()+"FFC\")+"_ws3client.vcx")
		loWSDailyDilbert = loWSHandler.SetupClient("http://www.esynaps.com/WebServices/DailyDiblert.asmx?WSDL", "DailyDilbert", "DailyDilbertSoap")

		lcBinary = loWSDailyDilbert.DailyDilbertImage()
		STRTOFILE(lcBinary, ADDBS(SYS(2023)) + "Dilbert.gif", 0)		

	CATCH TO loException
		DO CASE
		CASE VARTYPE(loWSDailyDilbert)#"O"
			* Handle SOAP error connecting to web service
		CASE !EMPTY(loWSDailyDilbert.FaultCode)
			* Handle SOAP error calling method
		OTHERWISE
			* Handle other error
		ENDCASE
	FINALLY
	ENDTRY

	RETURN
ENDFUNC

FUNCTION DisplayDilbert()

   IF FILE(ADDBS(SYS(2023)) + "Dilbert.gif")
		IF TYPE("_screen.imgDilbert") = "O" AND !ISNULL(_screen.imgDilbert)
		   _screen.RemoveObject("imgDilbert")
		ENDIF

		_screen.AddObject("imgDilbert", "image")
		_screen.imgDilbert.Picture = ADDBS(SYS(2023)) + "Dilbert.gif"
		_screen.imgDilbert.Visible = .T.   
   ENDIF

ENDFUNC
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform