Siemens 1500 LHTTPget and post api

stu

Member
Join Date
Aug 2005
Location
England
Posts
783
Hi
I’m struggling to understand how the LHTTP_post / get work ?
I have a url address given to me by the IT , I have to send a works order
number to api and then the http sends back 3 valves id1:39000 id2: 300000 id3: 900000

On the LHTTP_post instruction what is the data is that the value I want to send , and the same as the get instruction

I can’t see how to set up the lhttp, any information will help
 
You may not need to do a POST if it the HTTP client needs to send only a works order, but you do need the name of the works order that the HTTP server is looking for, e.g. can you connect a regular browser to the URL like this:

adding the text in blue - what comes back from the server? Presumably they gave you the name of the work order request name.
 
Last edited:
In the client/server dialog below, telnet to port 80 (HTTP protocol port) is me being the client.

  • I typed (pasted) everything in bold black;
    • the bold black starting with GET comprises
      • my GET request and the associated header,
      • the italics ?b=c&a=b after GET /get is the request data that I added to the request for the basic URL of http://eu.httpbin.org/get
      • with the empty line telling the server that my client request was done;
  • the bold magenta is the response header from the server
    • with the empty line telling the client that the previous line was the last response header line and the next line will be the first response data line.
  • The bold blue is the response data from the server.
    • Note that the args element of the response data echos the request data from my GET request
You don't have to code the equivalent of this raw socket dialog, because presumably the LHTTP* library handles most of this for you. But you do have to figure out how to add that work order as part of the GET (or POST) request.

$ telnet eu.httpbin.org 80
Trying 54.85.66.171...
Connected to eu.httpbin.org.
Escape character is '^]'.
GET /get?b=c&a=b HTTP/1.1
Host: eu.httpbin.org
User-Agent: telnet/by-hand
Accept: */*
<== empty line
HTTP/1.1 200 OK
Date: Mon, 28 Feb 2022 23:30:26 GMT
Content-Type: application/json
Content-Length: 301
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true
<== empty line

{
"args": {
"a": "b",
"b": "c"
},
"headers": {
"Accept": "*/*",
"Host": "eu.httpbin.org",
"User-Agent": "telnet/by-hand",
"X-Amzn-Trace-Id": "Root=1-621d5b12-0001054c426e522b3a48ea47"
},
"origin": "74.69.97.246",
"url": "http://eu.httpbin.org/get?b=c&a=b"
}



 
Last edited:

Similar Topics

Been fighting all morning with a stubborn HMI. It just won´t connect with the plc. attaching from settings. Have i missed anything? Both plc and...
Replies
5
Views
305
Hello everyone, I need your help. At one of my company instalations we have GE90-70, and we're going to replace it with some newer PLC. I prefer...
Replies
5
Views
517
Looking for options to write data to Siemens PLC. Looking for something closest to way we were doing it with AB PLC and excel sheet. Old way...
Replies
7
Views
900
We've got very fast machine whose position controlled by interrupt OB35 set at 2ms. For position reading we use Temposonic connected to TM...
Replies
19
Views
2,516
So, we have one servovalve that is very critical to machine operation and idea is (or was) to detect if valve gets disconnected from analog output...
Replies
11
Views
2,913
Back
Top Bottom