cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

.Net Edge Server SDK Returning Error (1001) Initializing web socket

mkamal
3-Newcomer

.Net Edge Server SDK Returning Error (1001) Initializing web socket

I am facing an issue when i am trying to implement the .net SDK example

I downloaded the version 5.0.1.103 of the SDK ThingWorx IoT Marketplace    » .NET SDK

Using VS2010 and ,net framwork 4.0 and using Tomcat 7.053 and Thingworx 6.03

I used the following documents :

.NET SDK quick start guide using the Steam Sensor example for ThingWorx

How to setup SSL on Tomcat with a Self-Signed Certificate for ThingWorx

Installing Thingworx Configuring Tomcat

I tried the following uri:

ws://127.0.0.1:8080/Thingworx/WS

wss://127.0.0.1:8443/Thingworx/WS

ws://Localhost:8080/Thingworx/WS

wss://Localhost:8443/Thingworx/WS

I made sure the user has developing rights "Administrator"

All my tries lead to the same error

"Error opening connecting to Platform. There was an error initializing the Socket. (Code 1001) " TwApiException was caught

20 REPLIES 20
VladimirRosu
19-Tanzanite
(To:mkamal)

Hi Mohamed,

Let's take this step by step:

1. make sure you know the address where TW is listening: in my case is https://localhost:8443/Thingworx/Composer/index.html

   In this case the corresponding ems connection string is: wss://127.0.0.1:8443/Thingworx/WS

   This comes without saying, but make sure the TW is indeed running in TLS mode.

2. in your ConnectedThingClient class, after the the line config.Claims=claims add config.AllowSelfSignedCertificates=true;

Try this and let me know!

BR,

Vladi

Hi Vladimir

Thanks for your reply

I already did those steps but not working ..!
But the good news are I created new application with SDK from Thingworx downloads not from the market place and V5.5 and V5.1 ware working fine

The SDK is only working with Thingworx 5

I wonder if there is a way to share the connection of Thingworx with Echeleon Smart Server and make it as case study for Street Lighting monitor and control system ?

radams11
1-Visitor
(To:mkamal)

I was trying the .NET SDK as well with ThingWorx 6 trying to get this example to work:

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS000208249

I keep getting an error on launch There was an error initializing the Socket. (Code 1001)

Anyone have a working example?

Aanjan
12-Amethyst
(To:radams11)

Quick question - as Vladimir had initially posted, can you access the platform at https://localhost:8443/Thingworx/Composer/index.html (or at https://localhost:443 based on which port it is on)?

radams11
1-Visitor
(To:Aanjan)

Hi aanjan

We've tried both the localhost and a sandbox hosted by ThingWorx.  We were able to connect to our server using the C and Java SDK, but not with the .NET SDK example.

Aanjan
12-Amethyst
(To:radams11)

Richard, what was the connection string you used?

radams11
1-Visitor
(To:Aanjan)

I connected with wss://xxxx.cloud.thingworx.com/Thingworx:443/WS api-key-xxxx 1000 (with our server address and api key instead of xxxes)

Aanjan
12-Amethyst
(To:radams11)

I know you stated the other SDKs connected fine, but can you try connecting the .NET once again with your firewall turned off?

radams11
1-Visitor
(To:Aanjan)

I get the same result with the firewall disabled.  Do you have the steamsensor example working in .NET?

Aanjan
12-Amethyst
(To:radams11)

Here is my basic version of the SteamSensor. I've added "config.DisableCertValidation = true;" and I'm using the 4.0 framework as the default framework. You would need to go to the Properties->Debug menu to edit your connection string.

radams11
1-Visitor
(To:Aanjan)

What Version of ThingWorx server are you running?

Aanjan
12-Amethyst
(To:radams11)

The platform? I'm currently using 6.0.0

mkamal
3-Newcomer
(To:Aanjan)

Hi Aanjan,

SDK Version ThingWorx-DotNet-SDK-5-5 (1 MB) OR ThingWorx-DotNet-SDK-5-0-1-103 (369 kb) downloaded from https://support.ptc.com/ not from Thingworx market working fine with only Thingworx Platform 5 and not working with Thingworx 6

The SDK from the marketplace.thingworx.com giving the 1001 Error

Note: Those SDKs will try communicate with Thingwx 6 with no errors but the platform will not sense the connection on the unbound tab

I will try to upload the the example

radams11
1-Visitor
(To:mkamal)

So is there an SDK that communicates with ThingWorx Platform 6.0?

I was able to get the latest .Net SDK (downloaded from the Market Place) to work by using the thingworx-dotnet-common.dll that came with the .Net SDK-5 that I downloaded from the download center (ThingWorx-DotNet-SDK-5-0-1-103 (369 kb) ). I had to change a few of the method calls due to those methods are deprecated with the latest dll.  I also changed the .Net Target Framework from 3.5 to 4.5.1. 

Aanjan
12-Amethyst
(To:mkamal)

Mohamed, DotNet-SDK-5-5 is the latest version of the SDK. Assuming you are testing the Steam Sensor example, do you already have SteamSensor1 and StreamSensor2 Things created? If so, when you run the SDK, it would automatically bind to those 2 Things, and you won't see them appear on the unbound tab.

Please do check the state of the 'isConnected' property under the Properties tab for either SteamSensor1 or 2 when the SDK is running.

mkamal
3-Newcomer
(To:Aanjan)

I know what u r talking about. I wasnt created the things yet

I was sure that thingworx 6 not working with SDK 5.5

emasiala
1-Visitor
(To:mkamal)

Sorry, I have read through all the comments and still cannot tell if the .NET  SDK 5.5 works with the Thingworx 6.0 platform? I was trying out the SteamSensor example, but keep getting the socket initialization error  (code 1001)..

The .Net SDK that I downloaded from the MarketPlace, version 5.5 I believe, from http://marketplace.thingworx.com/downloads/net-sdk/ will run the Steam Sensor example if I do not use the thingworx-dotnet-common.dll that was provided in the zip folder.

I also downloaded a .Net SDK, version 5.0.1.103 I believe, from https://support.ptc.com/appserver/auth/it/esd/sonproduct.jsp?son=2800716. If I use the thingworx-dotnet-common.dll from this download with the 5.5 .Net SDK, the Steam Sensor example works nicely. I believe the .Net SDK version from support.ptc.com is 5.0.1.103 as the file name is “ThingWorx-DotNet-SDK-5-0-1-103.zip”.

The attached dll will run the Steam Sensor example using the .Net SDK 5.5 and Thingworx 6.0 plateform.

If you were to compare the size of the two .dll’s from the two downloads, you will notice that the size of the attached dll is smaller than the dll downloaded with the 5.5 .Net SDK (approx. 357Kb verses 383 Kb).

Perhaps this problem has something to do with my version of .Net, Apache, or Java JRE? I started the virtual training today and the training direct users to install newer versions of the Java JRE and Apache compared to the versions I was instructed to download from the training information I was previously working from. Once I update all my software I will try the original thingworx-dotnet-common.dll (from the 5.5 .Net SDK) in my .Net environment and see if it will run the Steam Sensor example.

I will let you know what I find.

I hope this makes sense and thanks for looking into this.

Paul

Paul Wallace

Application Engineer

Hypertherm Automation Team

5 Technology Drive, Suite 300

West Lebanon, NH 03784

800-643-0030

http://www.hypertherm.com<http://www.hypertherm.com/>

Thank you Paul. I am also trying to use the SDK for our purposes, but having a hard time getting it to run.

Thanks for your response.

Announcements


Top Tags