Accessing Properties on Remote Things


#1

Dear all,

I have a problem to connect the service and properties from my remote thing to the platform.

When I start the ems server, I do not have any [ERROR]
…Using config file ….config.json
…httpServer: starting http server port=8000
…wsEmsProxy::initialize:Initialization complete!
…SDK: twWs_Connect:Websocket connected!

On the platform (ThingWorxMonitor) the thing is not yet connected

When I start the luascriptresource, I get [ERROR]
… httpServer: starting sttp server port=8001
… httpServer: Server socket error: Couldn’t bind address [127.0.0.1:8001]
…httpServer: unable to bind http server to any port from 8001 to 8001
…SolarCollector-1_staubv1:GetPropertySubscriptions called. 1 properties updated.

At that point I start to get [ERROR] from the wsems
…HttpResponse::processResponse.Parser only processed 0 out of 211 bytes. HPE_INVALID_CONSTANT Description:invalid constant string
…HttpClient::processReq:Timeout while waiting for response from localhost.

And on the platform (ThingWorxMonitor) the thing is connected but property (nor service) can not be accessed. I get same error message from wsems
Any idea? Thanks,


#2

Having the same issue. My log of the EMS looks like this:

academic-thingworxconnectivity.portal.ptc.io:443–>[INFO ] 2018-09-11 11:43:15,925 wsems: Starting the connection.
[INFO ] 2018-09-11 11:43:16,450: twWs_Connect: Websocket connected!
[WARN ] 2018-09-11 11:43:24,884 WsEmsProxy::bindThing: Exception connecting to localhost:8001. Err: Couldn’t connect to remote host [localhost:8001]
[WARN ] 2018-09-11 11:43:24,884: twBindBody_Delete: NULL body or stream pointer
[WARN ] 2018-09-11 11:43:24,884 WsEmsProxy::bindThing: Changing host from ‘localhost’ to ‘127.0.0.1’
[ERROR] 2018-09-11 11:43:24,884 aes_decrypt: Invalid Padding Size = 0xffffff8f.
[INFO ] 2018-09-11 11:43:25,267 WsEmsProxy::registerVirtualDirs: Adding virtual dir logs: C:\EMS\microserver\logs
[INFO ] 2018-09-11 11:43:25,267 WsEmsProxy::registerVirtualDirs: Adding virtual dir instruction: C:\EMS\microserver\instruction
[ERROR] 2018-09-11 11:43:26,115 HttpResponse::processResponse: Parser only processed 0 out of 211 bytes. Error: HPE_INVALID_CONSTANT Description: invalid constant string
[ERROR] 2018-09-11 11:43:26,115 HttpClient::processReq: Timeout while waiting for response from 127.0.0.1.

here is my config.json

{
“ws_servers”: [{
“host”: “academic-thingworxconnectivity.portal.ptc.io”,
“port”: 443
}],
“appKey”: “”,
“http_server” : {
“host”: “localhost”,
“port”: 8000,
“use_default_certificate” : true,
“ssl” : false,
“authenticate” : false
},
“certificates”: {
“validate”: false,
“cert_chain”: [“certificate.cer”]
},
“logger”: {
“level”: “INFO”,
“publish_directory”: “logs”,
“publish_level”: “INFO”,
“max_file_storage”: 2000000,
“auto_flush”: true,
“flush_chunk_size”: 16384,
“buffer_size”: 4096
},
“file”: {
“virtual_dirs”: [
{“logs”: “logs”},
{“instruction”:“instruction”}
],
“staging_dir”: “C:\EMS\microserver\staging”
}
}

My config.lua file looks like this:

– Logging

– Set the log level for the script resource.
– Available levels are FORCE, ERROR, WARN, INFO, DEBUG, and TRACE.
– Default value is INFO. When running as a service it is important
– to set this to ERROR, WARN, or INFO.

scripts.log_level = “INFO”
scripts.log_audit_target = “file://” or “http://”
scripts.log_publish_directory = “/_tw_logs/”
scripts.log_publish_level = “INFO”
scripts.log_max_file_storage = “2000000”
scripts.log_auto_flush = “true”
scripts.log_flush_chunk_size = “16384”
scripts.log_buffer_size = “4096”

– FIPS Mode

scripts.fips_enabled = false

– Connection parameters

scripts.rap_host = “localhost”
scripts.rap_port = “8000”
scripts.rap_ssl = false
scripts.rap_userid = “EMS HTTP Server User ID”
scripts.rap_password = “AES:EncryptedPassword”
scripts.rap_server_authenticate = false
scripts.rap_cert_file = “Path to CA cert file.”
scripts.rap_deny_selfsigned = false
scripts.rap_validate = false

– HTTP Server Configuration

scripts.script_resource_host = “localhost”
scripts.script_resource_port = “8001”
scripts.script_resource_ssl = “false”
scripts.script_resource_certificate_chain = “/path/to/lsr_http_server_certificate_chain/file”
scripts.script_resource_private_key = “/path/to/private/key”
scripts.script_resource_passphrase = “password”
scripts.script_resource_authenticate = “false”
scripts.script_resource_userid = “johnsmith”
scripts.script_resource_password = “AES:EncryptedPassword”
scripts.script_resource_use_default_certificate = true