About Event rules (Do HTTP request)
AnsweredHello
Reference: https://blog.clock-up.jp/entry/2016/12/01/csharp-http-server
Build HTTP server like above,
Is it possible to set "http://localhost:1000/" in Event rules (Do HTTP request) to operate other than REST API?
Calling the REST API on the server alone has succeeded.
HTTP server
The server performs the following processing after waiting
・POST /saveLayout
・Start HD Witness.exe
*Boot option
--Auth="https://user:pass@XX.XX.XX.XX:7001" --no-single-application --layout-name = "layout name"
Also, referring to here, HTTP content is empty and Content type is Auto.
(Reference: https://support.networkoptix.com/hc/en-us/articles/222669328-Action-Do-HTTP-Request)
-
Hi Takeshi,
You can call server itself to operate the HTTP API. You may refer to the example in this article. If you cannot use "localhost", try the IP(127.0.0.1) or check the host file in your server.
Let me know if you have further question about the case. Thank you.
1 -
Hi Tanaka-san,
Can you help to explain more about your use cases?
From the description you mentioned -
1) You have your own HTTP server than running on the same machine as Nx mediaserver?
2) The HTTP server is listening the request that would response. The address is http://localhost:1000?The action you mentioend - DO HTTP Request.
The action is for sending out the HTTP request, so it is a general operation.
It DOES NOT have to be RESTFUL API, instead, it is working with any HTTP request.We now can't make sure what does the following paragraph, can you explain what do you like to achieve?
1) Calling the REST API on the server alone has succeeded.
What does this mean? Why would this be mentioend? Any specific reasons?2) HTTP server
The server performs the following processing after waiting
・POST /saveLayout
・Start HD Witness.exe
*Boot option
--Auth="https://user:pass@XX.XX.XX.XX:7001" --no-single-application --layout-name = "layout name"
Which server is performing which process?
Are you trying to do remotely open a client on some PCs?0 -
Hi,Ichiro
Here are my goals:
Display the layout in a new window using "Event rules".
(I want the function to open the saved layout in a new window when the button is clicked)
For that, I tried the following.
However, if you execute 3, no action will occur.1. Built HTTP server Nx Witness(Client) and embedded the process to start REST API(SaveLayout) and "HD Witness.exe" when HTTP server was called.
2. Add setting to Nx Witness (Client)
・Set “http://localhost:1000/” in “Event rules” (Do HTTP request)
(See image.png for details)
3. Click the button added in "Event rules"
> 1) Calling the REST API on the server alone has succeeded.
> What does this mean? Why would this be mentioned? Any specific reasons?sorry. What I want to tell you is, if the Nx Witness (Client) browser executes the address (http://localhost:1000/),
You can view the layout in a new window.
(See WebPage.png)> 2) HTTP server
> Which server is performing which process?
> Are you trying to do remotely open a client on some PCs?Added the configuration of HTTP server.
● Server configuration
-Build an http server on the Nx Witness(Client) side and wait for http://localhost:1000/ with "HttpListener"
・Processing after waiting
・POST /ec2/saveLayout
*https://user:pass@XX.XX.XX.XX:7001/ec2/saveLayout・Start HD Witness.exe
*Boot option
--Auth="https://user:pass@XX.XX.XX.XX:7001" --no-single-application --layout-name = "layout name"
*XX.XX.XX.XX is the Nx Witness (Server) IP address
0 -
Hi Takeshi,
As I understand, you expected that two operations will be executed after you pressing soft button:
- Call API /saveLayout itself
- Launch the Nx client in a new window with the saved layoutCould you install the Nx server on another machine and configure the same event rule?
So that we could collect the wireshark packet between the new Nx server and your HTTP server. Then, check what's happened during communication.Thank you.
0 -
Hi Wendy Chuang
> Could you install the Nx server on another machine and configure the same event rule?
> So that we could collect the wireshark packet between the new Nx server and your HTTP server. Then, check what's happened during communication.I installed wireshark and collected packets, but the packets did not reach the Nx Witness server side.
0 -
Hi @...,
Supposed there're two machines now:
- Machine A: Install the original Nx mediaserver A and HTTP server(for the operations of API query and launch Nx client)
- Machine B: Install the new Nx mediaserver B for testing and packet collectingThe WireShark tool could run on the two machines at the same time.
Steps 1: Logged into the Nx server of machine B and press soft button to trigger the HTTP request (B -> A).
Steps 2: The HTTP server should return the HTTP response to the server B(A -> B).May I know which part you didn't see the packet reached?
I'd like to confirm if the HTTP server returns the 200 OK first.Thank you.
0 -
Hi,Wendy Chuang
When "http://localhost:1000/" is executed from the browser, HTTP protocol packet communication will flow.
(Refer to attached file)
When set to "Event Rules" and executed, Wireshark does not display HTTP protocol packet communication.Attach png file instead of pcap file due to file size limit
Nx Witness Client, HTTP Server: 10.12.2.58
Nx Witness Server:10.12.2.42Thanks
0 -
Hi @...,
When you execute the "http://localhost:1000/" on the built-in browser of Nx server, then you shouldn't get any packet dispalyed. Additionally, the requested host is 10.12.2.42:7001 instead of 10.12.2.58:1000. It looks like the packet just display the some regular task (for status check) instead of "http://localhost:1000/" request.
Let's try with the following configuration and scenario,
Nx Witness Client, HTTP Server: 10.12.2.58 (Machine A)
Nx Witness Server:10.12.2.42 (Machine B)- Test HTTP server via browser:
- Start packet capturing on machine A
- Under machine B, launch the web browser(Chrome) and visit "http://10.12.2.58:1000/"
- Check if the machine A is able to receive the HTTP request from 10.12.2.42
- Check if the HTTP server running the API request and launch Nx client successfully.
- Test HTTP request via Event rule:
- Start packet capturing on machine A
- Under machine B, execute the event rule and do HTTP request "http://10.12.2.58:1000/"
- Check if the machine A is able to receive the HTTP request from 10.12.2.42
- Check if the HTTP server running the API request and launch Nx client successfully.
If machine A didn't receive any HTTP packet from 10.12.2.42, then you might need to check the firewall configuration in machine A.
If we could get request under machine A, then we could check what's response it returns.Thank you.
0 - Test HTTP server via browser:
-
Hi,Wendy Chuang
By changing the port setting of firewall, I succeeded in starting it in another window.Thank you very much.
0 -
Hi Takeshi san,
Thanks for your feedback. If it could work by triggered event, then it should work on the local host (machine A).
Please let me know if the event is working on the 10.12.2.58 itself with localhost configuration now.
Thank you.
0
Please sign in to leave a comment.
Comments
10 comments