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:
00721321
Views:
7
Paul,

Very nice! thanks for sharing

>I was playing around with web services this afternoon and found a Dilbert web service. Here's some quicky code to demonstrate it. Run it in your startup routine!
>
>
>*-------------------------------------------------------------------------
>*
>* 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
>*
>*--------------------------------------------------------------------------
>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, HOME() + "Dilbert.bmp", 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(HOME() + "Dilbert.bmp")
>		IF TYPE("_screen.imgDilbert") = "O" AND !ISNULL(_screen.imgDilbert)
>		   _screen.RemoveObject("imgDilbert")
>		ENDIF
>		
>		_screen.AddObject("imgDilbert", "image")
>		_screen.imgDilbert.Picture = HOME() + "Dilbert.bmp"
>		_screen.imgDilbert.Visible = .T.
>   ENDIF
>
>ENDFUNC
>
Heavy Metal Pedal - click with care
Previous
Reply
Map
View

Click here to load this message in the networking platform