West Wind Internet and Client Tools
Action can't complete when web server not running
Gravatar is a globally recognized avatar based on your email address. Action can't complete when web server not running
  Eddie Tan
  All
  Oct 1, 2020 @ 12:06am

I had download the latest version wwclient 7.14 Testing program is running properly when web server is running, will prompt this message when web server is not running : after that prompt this :

coding :

SET PATH TO c:\wwclient, c:\wwclient\progs, c:\wwclient\classes
DO wwUtils 			&& Demo only
DO wwDotnetBridge	&& Load dependencies

do wwJsonSerializer

PUBLIC loBridge as wwDotnetBridge
PUBLIC p_startSecond
loBridge = GetwwDotnetBridge("V4")

*** Create a built-in .NET class
loHttp = loBridge.CreateInstance("System.Net.WebClient")

*** Create as callback object - object has to be 'global'
*** so it's still around when the callback returns
*** Use Public or attach to long lived object like form or _Screen
PUBLIC loCallback

p_startSecond = SECONDS()

loCallBack = CREATEOBJECT("HttpCallback")


*** Make the async call - returns immediately
loBridge.InvokeMethodAsync(loCallback, loHttp,"DownloadStringTaskAsync","http://192.168.50.168:5200/testpage.wc")
*loBridge.InvokeMethodAsync(loCallback, loHttp,"DownloadData","http://192.168.50.168:5200/testpage.wc")

? "Download has started... running in background."

RETURN


*** Callback class - AsyncCallbackEvents is Optional
DEFINE CLASS HttpCallback as AsyncCallbackEvents

************************************************************************
*  OnCompleted
****************************************
FUNCTION OnCompleted(lvResult, lcMethod)

? "Http Call completed"
*? "Received: " + TRANS(LEN(lvResult),"999,999,999")

*IF TYPE("lvResult.Result")!="O"
*	RETURN .f.
*endif

loResult = loBridge.GetProperty(lvResult,"Result")
*lcJson  = lvResult

IF !EMPTY(loResult )

	loSer = CREATEOBJECT("wwJsonSerializer")
	lcJson  = loSer.DeserializeJson(loResult)
	?lcJson  
	*WAIT WINDOW  tran((SECONDS()- p_startSecond) /1,"999.999s")+ TYPE("loResult.entered") NOWAIT
	*?lcJson.entered
	*WAIT WINDOW  TYPE("loResult.entered1")
	    &&loSer.Serialize(loResult,.T.)
	? loSer.Serialize(lcJson,.T.)
endif
*** Write to file to temp folder
*STRTOFILE(lvResult,ADDBS(SYS(2023)) + "HelpBuilderSetup.exe")

*TRY
*	*** Open the Zip file
*	DO wwutils
*	GoUrl(ADDBS(SYS(2023)) + "HelpBuilderSetup.exe")
*CATCH
*ENDTRY
*CLEAR EVENTS

ENDFUNC

************************************************************************
*  OnError
****************************************
FUNCTION OnError(lcErrorMessage, loException, lcMethod)
? lcErrorMessage
ENDFUNC

ENDDEFINE
Gravatar is a globally recognized avatar based on your email address. re: Action can't complete when web server not running
  Rick Strahl
  Eddie Tan
  Oct 1, 2020 @ 02:15pm

Please format your code in your message as described in the big fat message above the Post button.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Action can't complete when web server not running
  Eddie Tan
  Rick Strahl
  Oct 3, 2020 @ 04:54am

Hi, I think the coding is descript in Big fat message already. I hope I did correctly.

Gravatar is a globally recognized avatar based on your email address. re: Action can't complete when web server not running
  Rick Strahl
  Eddie Tan
  Oct 3, 2020 @ 11:28pm

Well you're making an HTTP request and the server is failing with an HTTP 500 response.

Check what the server is doing... Not much we can do to help you with this failure - you need to debug your server code.

+++ Rick ---

© 1996-2020