question

davide B avatar image
0 Likes"
davide B asked tannerp commented

WebComunication - applicationcommand("sendhttprequest",...)

Hi, I am trying to develop a flexsim application involving web comunication. As first attemp, i was trying to test some applications found in the forum, in particular the one described here.

Running the solution as it is, the system console will return two error messages in the form " Error 2.000000 has occurred. "

I think that the comunication is not working since tha server does not send any information back: the first call should write in Model/Tools/result the html page with random colors. Actually nothing is stored there, in particular printing the hexsadecimal code (at line 26) that should be taken from the html page is returning a white string:

string hexcolor = stringcopy(html, 1+stringsearch(html, colorprefixcode, 0)+stringlen(colorprefixcode), 6);
print("hexcolor is", hexcolor);
hexcolor is

53-getrandominternetcolor.fsm

FlexSim 18.1.1
web communicationsendhttprequest
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

1 Answer

Ben Wilson avatar image
1 Like"
Ben Wilson answered Ben Wilson edited

Hi @davide B,

The model you attached works fine for me. Perhaps your FlexSim installation is blocked from network communication by a firewall, on your PC or elsewhere on your network. Does your start page show online content when FlexSim starts?

Based on your description and your addition of a print() command, it appears that you are able to run the Script window. Script windows do require a license to run, so if anyone out there is using the free Express version, pressing that button doesn't do anything. In that case you could copy all the code in the script window to the processor's onReset trigger.

I have done so in the attached model. If you don't have a license, try the attached model. Just open it and hit Reset in the upper left corner. You should see the processor change color and the 3D text in the model view update.

getrandominternetcolor.fsm


5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.