Skip to main content
1-Visitor
October 19, 2018
Solved

How to connect EMS to ThingWorx Composer without SSL

  • October 19, 2018
  • 1 reply
  • 6992 views

 I am following the IoT Connectivity with Thingworx course and am trying to configure the json file for EMS to connect to my Thingworx server. It is running on http (no SSL). This is what I currently have in the json file.

{
    "ws_servers":    [{
            "host":    "http://192.168.1.170",
            "port":    80
        }],
    "appKey":    "ad2d631b-d6fe-45f0-a892-6dbc500fd339",
    "logger":   {
        "level":    "TRACE"
    },
    "certificates": {
        "validate": false
    },
    "http_server" : {
        "host": "localhost",
        "port":    8080,
        "ssl" : false,
        "authenticate": false        
    }
}

 

This is the error:

 

[WARN ] 2018-10-19 13:05:55,846 SDK: SDK Version: 2.0.4
[WARN ] 2018-10-19 13:05:55,847 SDK: TLS Library: OpenSSL
[WARN ] 2018-10-19 13:05:55,847 SDK: TLS Library Version: 1.0.2l
[WARN ] 2018-10-19 13:05:55,847 SDK: FIPS Capable
[DEBUG] 2018-10-19 13:05:55,847 SDK: twWs_Create: Initializing Websocket Client
for http://192.168.1.170:80//Thingworx/WS
[DEBUG] 2018-10-19 13:05:55,847 SDK: twTlsClient_Create: Initializing TLS Client

[TRACE] 2018-10-19 13:05:55,848 SDK: twSocket_Close: closing socket: 0, socket i
nfo - host: http://192.168.1.170, port: 80, proxyHost: NULL, proxyPort: 0, state
: 0
[DEBUG] 2018-10-19 13:05:55,848 SDK: twTlsClient_Close: Disconnecting from serve
r
[ERROR] 2018-10-19 13:05:55,848 SDK: twWs_Create: Error creating BSD socket to b
e used for the websocket
[ERROR] 2018-10-19 13:05:55,848 SDK: twApi_Initialize: Error creating websocket
structure, retrying
[FORCE] 2018-10-19 13:05:56,0 httpServer: starting http server port=8080
[DEBUG] 2018-10-19 13:05:56,3 httpServer: http server bound to port=8080.
[DEBUG] 2018-10-19 13:06:00,849 SDK: twWs_Create: Initializing Websocket Client
for http://192.168.1.170:80//Thingworx/WS
[DEBUG] 2018-10-19 13:06:00,849 SDK: twTlsClient_Create: Initializing TLS Client

[TRACE] 2018-10-19 13:06:00,849 SDK: twSocket_Close: closing socket: 0, socket i
nfo - host: http://192.168.1.170, port: 80, proxyHost: NULL, proxyPort: 0, state
: 0
[DEBUG] 2018-10-19 13:06:00,849 SDK: twTlsClient_Close: Disconnecting from serve
r
[ERROR] 2018-10-19 13:06:00,849 SDK: twWs_Create: Error creating BSD socket to b
e used for the websocket
[ERROR] 2018-10-19 13:06:00,849 SDK: twApi_Initialize: Error creating websocket
structure, retrying

 

 

Any ideas?

Adrian

Best answer by apdams

I have a config file that works. Problem now solved:

{
  "ws_servers": [{
    "host": "192.168.1.170",
    "port": 80
  }],
  "appKey": "f9efc9d8-1836-4a44-a8cb-1cb599bd4a49",
  "logger": {
    "level": "DEBUG"
  },
  "certificates": {
    "validate": false,
    "allow_self_signed": true
  },
  "ws_connection": {
    "encryption": "none",
    "verbose": true
  },
  "http_server" : {
        "host": "localhost",
        "port": 8084,    
        "ssl": false,
        "content_read_timeout": 20000,
    "authenticate": false
  }
}

1 reply

5-Regular Member
October 19, 2018

Hello.

 

If you just try connecting to tomcat (not ThingWorx) are you able to? And that is on port 8080, yes?

 

 

Thank you for using our community.

 

-- Craig A.

apdams1-VisitorAuthor
1-Visitor
October 19, 2018

Hi Craig

Well, I will try to respond correctly here. To be  honest, I did not install our Thingworx server, so don't know that much about it. I will also admit I just chose port 8080 in an attempt to solve the problem. I am not purposely trying to connect to tomcat, if that listens on port 8080. I just want a WS connection for EMS.

 

At any rate, if I try to connect to port 8080 in a browser on my ems machine, it fails. I hope that answers your question.

 

If I try another port (eg port 81), I get this error:

 

[WARN ] 2018-10-19 13:28:07,634 SDK: SDK Version: 2.0.4
[WARN ] 2018-10-19 13:28:07,634 SDK: TLS Library: OpenSSL
[WARN ] 2018-10-19 13:28:07,634 SDK: TLS Library Version: 1.0.2l
[WARN ] 2018-10-19 13:28:07,634 SDK: FIPS Capable
[DEBUG] 2018-10-19 13:28:07,634 SDK: twWs_Create: Initializing Websocket Client
for http://192.168.1.170:80//Thingworx/WS
[DEBUG] 2018-10-19 13:28:07,634 SDK: twTlsClient_Create: Initializing TLS Client

[TRACE] 2018-10-19 13:28:07,635 SDK: twSocket_Close: closing socket: 0, socket i
nfo - host: http://192.168.1.170, port: 80, proxyHost: NULL, proxyPort: 0, state
: 0
[DEBUG] 2018-10-19 13:28:07,635 SDK: twTlsClient_Close: Disconnecting from serve
r
[ERROR] 2018-10-19 13:28:07,635 SDK: twWs_Create: Error creating BSD socket to b
e used for the websocket
[ERROR] 2018-10-19 13:28:07,635 SDK: twApi_Initialize: Error creating websocket
structure, retrying
[FORCE] 2018-10-19 13:28:07,780 httpServer: starting http server port=81
[DEBUG] 2018-10-19 13:28:07,785 httpServer: http server bound to port=81.
[DEBUG] 2018-10-19 13:28:12,636 SDK: twWs_Create: Initializing Websocket Client
for http://192.168.1.170:80//Thingworx/WS
[DEBUG] 2018-10-19 13:28:12,636 SDK: twTlsClient_Create: Initializing TLS Client

[TRACE] 2018-10-19 13:28:12,636 SDK: twSocket_Close: closing socket: 0, socket i
nfo - host: http://192.168.1.170, port: 80, proxyHost: NULL, proxyPort: 0, state
: 0
[DEBUG] 2018-10-19 13:28:12,636 SDK: twTlsClient_Close: Disconnecting from serve
r
[ERROR] 2018-10-19 13:28:12,636 SDK: twWs_Create: Error creating BSD socket to b
e used for the websocket
[ERROR] 2018-10-19 13:28:12,636 SDK: twApi_Initialize: Error creating websocket
structure, retrying

5-Regular Member
October 19, 2018

Let's try the simple things first; are there any proxy servers or firewalls that might be interfering with communications on those ports?

 

 

-- Craig A.