This transport handler can be used to send Odysseus POST or PUT messages (e.g. via REST)

You will need to install the "Web Feature" to use this handler.

Parameter:

  • Path: The path the server should listen to. When not given, path is "/"
  • Port: The port for the http server. When not given: 8080
  • Hostname: The name of the server
  • immediate_response: A string with the response message to the client (use "false" for no reply)

Example

#PARSER PQL
#RUNQUERY
in = RECEIVE({
          transport = 'HttpServer',
          source = 'source',
          protocol = 'csv',
          datahandler = 'Tuple',
          schema = [['input','String']],
          options= [['immediate_response','ok']]        
        }
      )

Here a client sends a simple csv message with just a single entry. Odysseus does not care about the method (e.g. POST or PUT)


It is also possible to restrict the web server with credentials:

#PARSER PQL
#RUNQUERY
input = RECEIVE({
          transport = 'HTTPServer',
          source = 'source',
          protocol = 'Document',
          datahandler = 'Document',
          schema = [['content','String']],
          options= [['hostname','0.0.0.0'],['port', '8080'], ['path', '/'], ['onedocpercall', 'false']
			 ,['user','user']
			 ,['password','pass']
          ]
        }
      ) 

in this case you could e.g. send a message via curl:

curl -u user:pass -H "Content-Type: application/json" -d '{"data": { "eventtype":"leaf","epocutc":1671112105, "zone": "bz2454", "mac_address": "%%%MAC%%%", "RSSI":0 ,"techtype": 2}}' http://X.X.X.X:8080/




  • No labels