Experimental Physics and Industrial Control System
Hi Chris
I did something similar here:
https://paulscherrerinstitute.github.io/StreamDevice/tipsandtricks.html#web
At a first glance, all you did looks just fine.
As the host is running on Windows, do you need CR LF CR LF? (I hope not.)
I am testing now now one of our REST APIs....
Dirk
On Fri, 2022-06-10 at 13:10 +0000, Chris Gregory - STFC UKRI via Tech-talk wrote:
> I'm writing an IOC for a device that has a REST API. Replies are simple and predictable so I'm hoping that I won't
> need anything more complex than StreamDevice.
>
> At the moment I can't get a reply from the device. In my dev setup I'm running the IOC under WSL2, with the device
> software running on the Windows host on port 8001. The port is open in the firewall. Would anyone have any pointers
> please? (I've subbed my real Windows host ip address with <my_ip_address> in the below but in the application I've got
> the full address written out.)
>
>
> Protocol:
> read_variable{
> outTerminator = LF LF;
> replyTimeout = 5000;
> out "GET http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State HTTP/1.1";
> in "%#s";
> }
>
> Record:
> record (stringin, "RDV_TEST") {
> field(DTYP, "stream")
> field(INP, "@eksplaAPL038.proto read_variable() $(PORT)")
> field(SCAN, "5 second")
> }
>
>
> PORT configuration in st.cmd:
> drvAsynIPPortConfigure("$(PORT)", "<my_ip_address>:8001 HTTP",0,0,0)
>
>
> When I run the IOC the asynTraceMask shows that I'm sending what I expect, but I don't get any reply. E.g.
> epics> 2022/06/10 13:40:59.703 <my_ip_address>:8001 HTTP write 67
> GET http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State HTTP/1.1\n\n
>
>
> Using telnet from WSL2 with the same ip:port the following both succeed and get the expected reply from the device:
> GET http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State HTTP/1.1
> or
> GET /REST/HTTP_CMD/?RDVAR/State HTTP/1.1
>
>
> I've tried the following "out" commands in the protocol file. No reply in any case:
> out "GET http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State HTTP/1.1";
> out "GET http://<my_ip_address>:8001/REST/HTTP_CMD/?RDVAR/State";
> out "GET /REST/HTTP_CMD/?RDVAR/State HTTP/1.1";
> out "GET /REST/HTTP_CMD/?RDVAR/State";
>
> I'd be grateful for any help,
> Chris
>
>
> This email and any attachments are intended solely for the use of the named recipients. If you are not the intended
> recipient you must not use, disclose, copy or distribute this email or any of its attachments and should notify the
> sender immediately and delete this email from your system. UK Research and Innovation (UKRI) has taken every
> reasonable precaution to minimise risk of this email or any attachments containing viruses or malware but the
> recipient should carry out its own virus and malware checks before opening the attachments. UKRI does not accept any
> liability for any losses or damages which the recipient may sustain due to presence of any viruses.
>
- Replies:
- Re: StreamDevice with a REST API Kasemir, Kay via Tech-talk
- References:
- StreamDevice with a REST API Chris Gregory - STFC UKRI via Tech-talk
- Navigate by Date:
- Prev:
StreamDevice with a REST API Chris Gregory - STFC UKRI via Tech-talk
- Next:
RE: StreamDevice with a REST API Freddie Akeroyd - STFC UKRI via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
<2022>
2023
2024
- Navigate by Thread:
- Prev:
StreamDevice with a REST API Chris Gregory - STFC UKRI via Tech-talk
- Next:
Re: StreamDevice with a REST API Kasemir, Kay via Tech-talk
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
<2022>
2023
2024