Can not connect to Watson IoT - connection refused - watson-iot

I'm following these instructions using the orgID given by the Watson IoT platform.
I then created the MQ Client in Node-RED using this orgID and
d:orgID:mydevicetype:mydevicedid using arbitrary mydevicetype and mydevicedid.
These are the Node-RED error messages:
"Error: Connection refused: Not authorized"
"Error stopping node: Error: [BaseClient:disconnect] Client is not connected"
I then created a device on the Watson IoT platform using the mydevicetype and mydevicedid and eas provided a token.
I got the same error using use-token-auth as the user and the token as password.
Device log on the Watson IoT platform:
Invalid userID () for device auth:
ClientID='d:orgID:mydevicetype:mydevicdeid',
ClientIP=169.50.40.xxx

Can you try:
url: mqtts://[orgId].messaging.internetofthings.ibmcloud.com
port:8883
username: use-token-auth
password: [the token you got when you created the device]
client id: d:[orgID]:[mydevicetype]:[mydeviceid]
Looks like not much different from what you've tried, perhaps your are not using a secure (mqtts) connection ?

If the client id that you are specifying really is:
d:orgID:mydevicetype:mydevicdeid
then your problem is that you need to specify the actual 6 character orgId, e.g.:
d:abcdef:mydevicetype:mydevicdeid
Give that a go and let us know how you get on.

Related

Invalid Return Code from Greengrass Discovery

Using the AWS IoT Device SDK from GitHub, I'm testing from my local machine using the basic_discovery.py script I can see that it returns the IP address and port from my Raspberry PI running as a Greengrass device, however, I see that I'm getting invalid return codes from the subsequent request when it is attempting to connect with the PI device. The error messages I am getting are as follows:
Trying core arn:aws:iot:us-east-1:111111111111:thing/GreengrassPI at host 192.168.1.176 port 8883
[ERROR] [2022-07-20T20:42:02Z] [00007000017de000] [mqtt-client] - id=0x7fd8b24b4b60: invalid connect return code 4, disconnecting
[ERROR] [2022-07-20T20:42:02Z] [00007000017de000] [tls-handler] - id=0x7fd89242aba0: error reported during SSLRead. OSStatus code -9805
Connection failed with exception AWS_ERROR_MQTT_PROTOCOL_ERROR: Protocol error occurred.
All connection attempts failed
[ERROR] [2022-07-20T20:42:02Z] [0000000116728e00] [mqtt-client] - id=0x7fd8b24b4b60: Connection is not open, and may not be closed
Any suggestions as to what to check? I did not see anything on this in the troubleshooting guide.
[SOLVED] So what I found was that the device name I was using in the test script was not listed in the client device associations for the Greengrass core device. Adding the association resolved the problem. For anyone else that runs into something similar refer to this for information on associating devices. In summary what happened is that the script was able to look up the Greengrass core device but when it attempted to send an MQTT message to it, the Greengrass core device refused it because the device was not associated to it.

Microsoft Example 52 -

I managed to get Microsoft Example 52 to work last friday. But after the weekend (from 13. January on) I get the following error:
Error refreshing OpenId configuration:
System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://login.botframework.com/v1/.well-known/openidconfiguration'.
at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync(CancellationToken cancel) at Microsoft.IdentityModel.Protocols.ConfigurationManager1.GetConfigurationAsync()
at Microsoft.Bot.Connector.Authentication.JwtTokenExtractor.ValidateTokenAsync(String jwtToken, String channelId, String[] requiredEndorsements)
...
Error refreshing OpenId configuration: System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'https://login.botframework.com/v1/.well-known/openidconfiguration'.
---> System.IO.IOException: IDX20804: Unable to retrieve document from: 'https://login.botframework.com/v1/.well-known/openidconfiguration'.
---> System.Net.Http.HttpRequestException: connection attempt failed because the remote peer did not respond properly after a certain period of time, or the established connection was faulty because the connected host did not respond.
---> System.Net.Sockets.SocketException (10060): A connection attempt failed because the remote terminal did not respond properly after a certain period of time, or the established connection was faulty because the connected host did not respond
-> By the way I translated the last two exceptions with deepl as they where in German
I already checked the forum and also documentation but with no luck.
Today I tried the example from scratch with different bot, different bot channels registration, and new copied example project but I still get the same error.
I still have to mention: The only difference to documentation is, that I registered bot and channel registration with another my azure user. And in teams I use an other account with office 365 business basic license. But last week it has worked - so maybe that's no problem at all!?!
Does anyone has an idea what to try next?
As per the comments above, this sounded like an issue with how the bot was hosted, and jwt validation code not being able to call out to the internet (e.g. a security or proxy setting). It needs to be able to physically call out to login.botframework.com/v1/.well-known/openidconfiguration . That might be fine on a local dev workstation, but blocked on an internal company server, for instance. In the end it was something in this line - proxy settings blocking the outgoing call, so listing it here as an answer for future visitors.

Connecting ibm bluemix watson IoT using erlang mqtt websocket client on port 443

MQTT over Websocket protocol
I'm trying to connect IBM Watson IoT service using erlang mqtt websockets on port 443(ssl/tls). But, I was receiving error.
The IBM dos(https://console.ng.bluemix.net/docs/services/IoT/iotplatform_task.html#devices) says that it support websocket connection. There is no mention of the websocket usage(tutorials/guide) except normal tcp connection(which i was successfull at getting conected).
I want a simple step by step doc like the Amazon IoT (http://docs.aws.amazon.com/iot/latest/developerguide/protocols.html) for websocket connectivity as a client application.
I'm figuring about the URL/URI which I think might be improper i.e ws(s)://host:port/path.
Currently, i'm giving it as wss://fybr123mqtt.mybluemix.net
(where fybr123mqtt is my application name).
What is the host, port & path for connecting to IBM Watson IoT through mqtt ?
And how to send other parameters like 'client_id', 'username', 'password', 'authentication token' along with the HOST ?
Also, suggest some erlang websocket client for mqtt and also mention simple steps to access the websocket server. Erlang mqtt client (emqttc) does not support websocket.
The connection process is clearly described here:
console.ng.bluemix.net/docs/services/IoT/devices/mqtt.html
The URL that you mentioned is not correct: wss://fybr123mqtt.mybluemix.net
On Step 2: Connecting your devices to Watson IoT Platform from console.ng.bluemix.net/docs/services/IoT/iotplatform_task.html#devices it says the following:
The following information is required when connecting your device:
URL: org_id.messaging.internetofthings.ibmcloud.com
Where org_id is the ID of your Watson IoT Platform organization.
Port:
1883
8883 (encrypted)
443 (websockets)
Device identifier: d:org_id:device_type:device_id
This combination of parameters uniquely identifies your device.
Username: use-token-auth
This value indicates that you are using token authorization.
Password: Authentication token
This value is the unique token that you defined or that was assigned to your device when you registered it.
The org_id, device_type, device_id and password are provided after you complete Step 1: Registering your device with Watson IoT Platform
Note: The clienID is Device identifier: d:org_id:device_type:device_id
I successfully used mqttfx, eclipse paho, mosquitto and there are a lot of other free mqtt clients that you can use.
Also, there are good tutorials (recipes) that can help you get starter with IBM's client libraries in Java, Pyhton, etc. As examples you can have a look on:
"ibm.com/developerworks/cloud/library/cl-mqtt-bluemix-iot-node-red-app/"
Here is an example for gateway device type with mosquitto
"developer.ibm.com/recipes/tutorials/using-mosquitto-as-a-gateway-for-watson-iot/"
Lets not forget the client nodes from NodeRed, that are very easy to use.
Let me know if you still need help on this.
Thanks,
Daniel
Url: wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:8883
It works fine using NodeJS. I don't specify a further endpoint.
[BaseClient:connect] Connecting to IoTF with host : wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:8883
[DeviceClient:connect] DeviceClient Connected
connected
[DeviceClient:publish] Publishing to topic iot-2/evt/myevt/fmt/json with payload {"radiation":1} with QoS 2
This is based off the sample client code with "enforce-ws" : true
I modified that client and tested with 443 also:
[BaseClient:connect] Connecting to IoTF with host : wss://6DigitOrgID.messaging.internetofthings.ibmcloud.com:443
[DeviceClient:connect] DeviceClient Connected
connected
[DeviceClient:publish] Publishing to topic iot-2/evt/myevt/fmt/json with payload {"radiation":1} with QoS 2
I don't know of any samples for erlang.

Unable to connect to feedback.sandbox.apple.com via tcp client in pushsharp

Unable to connect to the feedback.sandbox.push.apple.com with port number 2196.
Opened the ports (5223, 2915, 2916, 443) in windows firewall with TCP/SSL.
Tried connecting via telnet too, but did not help.
Getting the below exception
Service Exception: PushSharp.Apple.ApplePushService -> System.Net.Sockets.Socket
Exception (0x80004005): A connection attempt failed because the connected party
did not properly respond after a period of`enter code here` time, or established connection faile
d because connected host has failed to respond 17.172.232.45:2196
at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port)
at PushSharp.Apple.FeedbackService.Run(ApplePushChannelSettings settings, Can
cellationToken cancelToken) in d:\Sample Apps\Push Notification\PushSharp-master
\PushSharp-master\PushSharp.Apple\FeedbackService.cs:line 60
at PushSharp.Apple.ApplePushService.<>c__DisplayClass4.<.ctor>b__1(Object sta
te) in d:\Sample Apps\Push Notification\PushSharp-master\PushSharp-master\PushSh
arp.Apple\ApplePushService.cs:line 51
Failure: PushSharp.Apple.ApplePushService -> The maximum number of Send attempts
to send the notification was reached! -> {"aps":{"alert":"Hello World!","badge"
:7,"sound":"sound.caf"}}
Also, this does not need certificate to connect to sandbox, so why this exception?
You do need a development certificate from the Apple Developer portal to connect to sandbox. But I don't know if you need to use it to connect to feedback.sandbox.apple.
I can't seem to find a straight answer on this whether feedback services still works. I think APNS Feedback services are now deprecated. This could be why you're getting this error.
Does APNS Feedback service no longer exist as per new APIs?
APNS Feedback Service - is it still alive?

WebHost failed to process a request on IIS 7 windows 2008 when using Windows Mobile

I have developed a webservice using WCF and secured it using NTLM over SSL. I am able to connect successfully using from a visual Studio 2008 form or Web Project. The problem I am having is when creating a smart device project and deploying it on the device.
when I call the service, from client side I get the error: Web Exception
on the server site, when i check the Event Log I get the following Error:
**Sender Information: System.ServiceModel.Activation.HostedHttpRequestAsyncResult/7491627
Exception: System.Web.HttpException (0x80004005): There was no channel actively listening at 'https://mymachine:9011/FrontEndWS/MeterReadingService.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening. --->
System.ServiceModel.EndpointNotFoundException: There was no channel actively listening at 'https://mymachine:9011/FrontEndWS/MeterReadingService.svc/$metadata'. This is often caused by an incorrect address URI. Ensure that the address to which the message is sent matches an address on which a service is listening.
at System.ServiceModel.Activation.HostedHttpTransportManager.HttpContextReceived(HostedHttpRequestAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.HandleRequest()
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.BeginRequest()
at System.Runtime.AsyncResult.End[TAsyncResult](IAsyncResult result)
at System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result)**
Process Name: w3wp
Process ID: 2828
Cannot figure out why this is happening from mobile devices but works fine from a PC.

Resources