2 posts / 0 new
Last post
tthayer
CoAP Observer returns 404

From the session below , when they send a GET to /sensor/rl78/methane?sens, they get a 2.05, when I ask them to issue the same command with the observe option set, they claim it’s sending a POST. Logs below.

 

My questions are:

  1. Are they using the same client for both requests?
  2. What client is it? Who wrote it?
  3. Is it really sending a POST? If so, why?

 

[19/10/2017, 10:23:37 AM] Yoshi: sensor/rl78/methane

[19/10/2017, 10:26:03 AM] David Cecil: line 117 returns 404. Do you know if that’s where the return code is coming from?

[19/10/2017, 10:26:36 AM] David Cecil: mshield.cpp

[19/10/2017, 10:30:19 AM] Yoshi: rsp->code = COAP_RSP_404_NOT_FOUND;

[19/10/2017, 10:30:26 AM] Yoshi: right?

[19/10/2017, 10:30:46 AM] David Cecil: yes

[19/10/2017, 10:31:11 AM] David Cecil: Also, you are issuing a GET, right? Not a PUT?

[19/10/2017, 10:31:36 AM] Yoshi: yes

[19/10/2017, 10:31:50 AM] David Cecil: good

[19/10/2017, 10:32:17 AM] David Cecil: It’s returning 404, not 405, right?

[19/10/2017, 10:35:42 AM] David Cecil: I mean, in the response sent to the client, the code is 404, not 405.

[19/10/2017, 10:35:54 AM] David Cecil: I am asking because there are a lot of places where the code returns 405 too.

[19/10/2017, 10:36:03 AM] David Cecil: I want to be certain you’re getting a 404 at the client.

 

 

[19/10/2017, 10:36:12 AM] Yoshi: 2017-10-18 12:21:40,563 | SDKCoAPClient I/O Worker #3      | SdkObservationCallback              | INFO  | Notification #2: CoAP: [Header: (V) 1, (T) NON (1), (TKL) 8, (C) CONTENT (69), (ID) 63777 | (Token) 0xA76753C1EBDFFDDF | Options: (No. 6) 1536 (No. 12) 2 (No. 14) 3019898880 | Content: 19,h,OK,St,... ( 11 bytes)]

2017-10-18 12:21:40,565 | SDKCoAPClient I/O Worker #3      | SdkObservationCallback              | INFO  | ***Payload As String: <19,h,OK,St,>

2017-10-18 12:21:40,570 | SDKCoAPClient I/O Worker #3      | SdkObservationCallback              | INFO  | ***Payload As Hex: (heart) 1392c682c4f4b2c53742cdf620600610224b4000000ff31392c682c4f4b2c53742c>

2017-10-18 12:21:40,572 | SDKCoAPClient I/O Worker #3      | SdkObservationCallback              | INFO  | Sending observation to Starfish

2017-10-18 12:23:38,910 | SDKCoAPClient I/O Worker #3      | StarfishClient                 | ERROR | Starfish observations call failed: 404

[19/10/2017, 10:36:47 AM] David Cecil: definitely 404, thank you.

[19/10/2017, 10:40:09 AM] Akira: Do we have to change .jar client software?

[19/10/2017, 10:40:42 AM] Yoshi: sdkcoapclient-1.1.0.one-jar  --> need to change ?

[19/10/2017, 10:42:32 AM] David Cecil: Can you send the GET request without the observe (6) option set please?

 

[19/10/2017, 10:49:06 AM] Yoshi: C:\usr\local\coap>java -jar sdkcoapclient-1.2.0.one-jar.jar --conf 171012_test1_get_hdk_methane.json

2017-10-19 09:47:11,306 | SDKCoAPClient I/O Worker #1      | ResponseDispatcher

                 | INFO  | Added callback (remote endpoint: api.coap-staging.dev

eloper.ssni.com/74.121.19.183:5683, token: 0xE23A0D860EA34BC4)

2017-10-19 09:47:11,308 | SDKCoAPClient I/O Worker #1      | ClientOutboundRelia

bilityHandler    | DEBUG | HANDLE OUTBOUND MESSAGE: [Header: (V) 1, (T) CON (0),

(TKL) 8, (C) GET (1), (ID) -1 | (Token) 0xE23A0D860EA34BC4 | Options: (No. 23)

3 (No. 35) coap://SSN001350050047dd7b.SG.YEL01.SSN.SSNSGS.NET:4849/sensor/rl78/methane?sens (No. 124) <empty> | Content: <no content>]

2017-10-19 09:47:11,310 | SDKCoAPClient I/O Worker #1      | ClientOutboundRelia

bilityHandler    | INFO  | Set message ID to 57943

2017-10-19 09:47:11,312 | SDKCoAPClient I/O Worker #1      | ClientOutboundRelia

bilityHandler    | DEBUG | Scheduled transmission #2 with delay 2865 ms (Remote

Socket: api.coap-staging.developer.ssni.com/74.121.19.183:5683, message ID: 5794

3).

2017-10-19 09:47:11,313 | SDKCoAPClient I/O Worker #1      | ClientOutboundRelia

bilityHandler    | DEBUG | Scheduled transmission #3 with delay 8249 ms (Remote

Socket: api.coap-staging.developer.ssni.com/74.121.19.183:5683, message ID: 5794

3).

2017-10-19 09:47:11,314 | SDKCoAPClient I/O Worker #1      | ClientOutboundRelia

bilityHandler    | DEBUG | Scheduled transmission #4 with delay 18783 ms (Remote

Socket: api.coap-staging.developer.ssni.com/74.121.19.183:5683, message ID: 579

43).

2017-10-19 09:47:11,315 | SDKCoAPClient I/O Worker #1      | ClientOutboundRelia

bilityHandler    | DEBUG | Scheduled transmission #5 with delay 37500 ms (Remote

Socket: api.coap-staging.developer.ssni.com/74.121.19.183:5683, message ID: 579

43).

2017-10-19 09:47:11,317 | SDKCoAPClient I/O Worker #1      | AbstractIdentificat

ionHandler       | INFO  | Added ID to identify remote host api.coap-staging.dev

eloper.ssni.com/74.121.19.183:5683: 0xDD9E0585

2017-10-19 09:47:11,318 | SDKCoAPClient I/O Worker #1      | CoapMessageEncoder

                 | INFO  | CoapMessage to be encoded: [Header: (V) 1, (T) CON (0

), (TKL) 8, (C) GET (1), (ID) 57943 | (Token) 0xE23A0D860EA34BC4 | Options: (No.

23) 3 (No. 35) coap://SSN001350050047dd7b.SG.YEL01.SSN.SSNSGS.NET:4849/sensor/r

l78/methane?sens (No. 124) 0xDD9E0585 | Content: <no content>]

2017-10-19 09:47:14,177 | SDKCoAPClient I/O Worker #3      | CoapMessageEncoder

                 | INFO  | CoapMessage to be encoded: [Header: (V) 1, (T) CON (0

), (TKL) 8, (C) GET (1), (ID) 57943 | (Token) 0xE23A0D860EA34BC4 | Options: (No.

23) 3 (No. 35) coap://SSN001350050047dd7b.SG.YEL01.SSN.SSNSGS.NET:4849/sensor/r

l78/methane?sens (No. 124) 0xDD9E0585 | Content: <no content>]

2017-10-19 09:47:14,182 | SDKCoAPClient I/O Worker #3      | SdkCallback

                 | INFO  | Retransmission #1

2017-10-19 09:47:14,184 | SDKCoAPClient I/O Worker #3      | ClientOutboundRelia

bilityHandler    | DEBUG | Finished transmission #1: [Header: (V) 1, (T) CON (0)

, (TKL) 8, (C) GET (1), (ID) 57943 | (Token) 0xE23A0D860EA34BC4 | Options: (No.

23) 3 (No. 35) coap://SSN001350050047dd7b.SG.YEL01.SSN.SSNSGS.NET:4849/sensor/rl

78/methane?sens (No. 124) 0xDD9E0585 | Content: <no content>]

2017-10-19 09:47:19,562 | SDKCoAPClient I/O Worker #6      | CoapMessageEncoder

                 | INFO  | CoapMessage to be encoded: [Header: (V) 1, (T) CON (0

), (TKL) 8, (C) GET (1), (ID) 57943 | (Token) 0xE23A0D860EA34BC4 | Options: (No.

23) 3 (No. 35) coap://SSN001350050047dd7b.SG.YEL01.SSN.SSNSGS.NET:4849/sensor/r

l78/methane?sens (No. 124) 0xDD9E0585 | Content: <no content>]

2017-10-19 09:47:19,565 | SDKCoAPClient I/O Worker #0      | SdkCallback

                 | INFO  | Retransmission #2

2017-10-19 09:47:19,566 | SDKCoAPClient I/O Worker #0      | ClientOutboundRelia

bilityHandler    | DEBUG | Finished transmission #2: [Header: (V) 1, (T) CON (0)

, (TKL) 8, (C) GET (1), (ID) 57943 | (Token) 0xE23A0D860EA34BC4 | Options: (No.

23) 3 (No. 35) coap://SSN001350050047dd7b.SG.YEL01.SSN.SSNSGS.NET:4849/sensor/rl

78/methane?sens (No. 124) 0xDD9E0585 | Content: <no content>]

2017-10-19 09:47:19,603 | SDKCoAPClient I/O Worker #5      | ClientOutboundRelia

bilityHandler    | DEBUG | Could not cancel transmission #1 (Remote Socket: /74.

121.19.183:5683, Message ID: 57943)

2017-10-19 09:47:19,604 | SDKCoAPClient I/O Worker #5      | ClientOutboundRelia

bilityHandler    | DEBUG | Could not cancel transmission #2 (Remote Socket: /74.

121.19.183:5683, Message ID: 57943)

2017-10-19 09:47:19,605 | SDKCoAPClient I/O Worker #5      | ClientOutboundRelia

bilityHandler    | DEBUG | Could not cancel transmission #3 (Remote Socket: /74.

121.19.183:5683, Message ID: 57943)

2017-10-19 09:47:19,606 | SDKCoAPClient I/O Worker #5      | ClientOutboundRelia

bilityHandler    | DEBUG | Cancelled transmission #4 (Remote Socket: /74.121.19.

183:5683, Message ID: 57943)

2017-10-19 09:47:19,606 | SDKCoAPClient I/O Worker #5      | ClientOutboundRelia

bilityHandler    | DEBUG | Cancelled transmission #5 (Remote Socket: /74.121.19.

183:5683, Message ID: 57943)

2017-10-19 09:47:19,607 | SDKCoAPClient I/O Worker #5      | ClientOutboundRelia

bilityHandler    | INFO  | Received empty ACK from "/74.121.19.183:5683" for tok

en 57943 (Message ID: 0xE23A0D860EA34BC4).

2017-10-19 09:47:19,607 | SDKCoAPClient I/O Worker #4      | ClientBlock2Handler

                 | DEBUG | HANDLE INBOUND MESSAGE: [Header: (V) 1, (T) ACK (2),

(TKL) 0, (C) EMPTY (0), (ID) 57943 | (Token) <EMPTY> | Options: | Content: <no c

ontent>]

2017-10-19 09:47:27,564 | SDKCoAPClient I/O Worker #6      | CoapMessageDecoder

                 | INFO  | Previous option: 0, Option delta: 12

2017-10-19 09:47:27,565 | SDKCoAPClient I/O Worker #6      | CoapMessageDecoder

                 | INFO  | Decode option no. 12 with length of 1 bytes.

2017-10-19 09:47:27,570 | SDKCoAPClient I/O Worker #6      | CoapMessageDecoder

                 | INFO  | Decoded Message: [Header: (V) 1, (T) NON (1), (TKL) 8

, (C) CONTENT (69), (ID) 65535 | (Token) 0xE23A0D860EA34BC4 | Options: (No. 12)

2 | Content: 0,h,

 

 

Then sending the observe request:

{

  "proxyHost": "api.coap-staging.developer.ssni.com",

  "proxyPort": "5683",

  "clientPort": "6000",

  "observe": "true",

  "maxNotifications": "2000",

  "method" : "GET",

  "timeout": "3000",

  "clientId": "0e61152a-af9b-48c6-8a1c-xxxx",

  "clientSecret": "6C3pTPYTZDnI74lS59Jz4s2m0b1yysxvzabmKF+xxxx",

  "devices": [

    {

      "deviceId": "adbd1756-9b15-49e2-af30-fc91d8756038",

      "deviceHost": "SSN001350050047dd7b.SG.YEL01.SSN.SSNSGS.NET",

      "devicePort": "4849",

      "devicePath": "/sensor/rl78/methane",

      "deviceQuery": "sens"

    }

  ]

}

 

 

2017-10-18 12:21:40,572 | SDKCoAPClient I/O Worker #3      | SdkObservationCallback              | INFO  | Sending observation to Starfish

2017-10-18 12:23:38,910 | SDKCoAPClient I/O Worker #3      | StarfishClient                 | ERROR | Starfish observations call failed: 404

2017-10-18 12:23:38,915 | SDKCoAPClient I/O Worker #3      | SdkObservationCallback              | INFO  | continueObservation: 2

2017-10-18 12:23:38,917 | SDKCoAPClient I/O Worker #3      | SdkObservationCallback              | INFO  | Received true/{} responses (continue observation: {})

2017-10-18 12:24:58,834 | SDKCoAPClient I/O Worker #7      | MessageIDFactory                 | INFO  | Released message ID "42902" (Remote Socket: "api.coap-staging.developer.ssni.com/74.121.19.183:5683", Token: 0xA76753C1EBDFFDDF

2017-10-18 12:24:58,839 | SDKCoAPClient I/O Worker #7      | ClientOutboundReliabilityHandler    | INFO  | Message ID was released (remote socket: "{}", token:{}, message ID: {})

2017-10-18 13:12:39,521 | main                             | CoapClient                 | WARN  | Start to shutdown SDKCoAPClient (Port : 6000)

2017-10-18 13:12:39,525 | main                             | CoapClient                 | WARN  | Channel closed (SDKCoAPClient).

2017-10-18 13:12:39,529 | main                             | CoapClient                 | WARN  | External resources released (SDKCoAPClient).

2017-10-18 13:12:39,532 | main                             | CoapClient                 | WARN  | Shutdown of SDKCoAPClient completed.

 

 

[19/10/2017, 11:13:32 AM] David Cecil: OK, but when you sent a GET without observe, it returns 205 (good). When you send the same request but with the observe option set, there’s a 404.

[19/10/2017, 11:13:55 AM] David Cecil: Are you saying your subcpu returns 205 but something changes the response on its way to the client?

[19/10/2017, 11:16:22 AM] David Cecil: OR are you getting a bad request from starfish?

[19/10/2017, 11:17:09 AM] Yoshi: We think that the point of happened error are Starfish client.java,line 152.

[19/10/2017, 11:17:30 AM] Yoshi: sdkcoapclient

[19/10/2017, 11:17:53 AM] David Cecil: OK, I don’t have that code at the moment. Is it a problem creating the GET request?

[19/10/2017, 11:18:59 AM] Yoshi: Data platform POST request

[19/10/2017, 11:19:09 AM] David Cecil: POST?

[19/10/2017, 11:19:18 AM] David Cecil: It shouldn’t be sending a POST.

Yoshi: in sdkcoapclient-1.1.0.one-jar

[19/10/2017, 11:31:34 AM] David Cecil: Does the subcpu receive the POST request?

[19/10/2017, 11:31:39 AM] David Cecil: From the client?

[19/10/2017, 11:31:46 AM] David Cecil: (Sorry, just trying t clarify)

[19/10/2017, 11:32:26 AM] Yoshi: can not it

[19/10/2017, 11:32:39 AM] Yoshi: NO

bluben
Root Cause of 404

The root cause of the issue Yoshi has reported is that an incorrect deviceId has been used in the observe command json. This deviceId does not belong to the tenant identified by the clientId and clientSecret. What happens is that the observe gets established on the device, the device sends a repsonse which the Java CoAP Client reads. When the client tries to send the observed data to Starfish (it uses the Starfish observations API), the data platform validates the device specified by the deviceId and can't find an associated device that belongs to the tenant. It repsonds with a 404, which is being reported by the client.

The fix is to use the correct deviceId. To determine the deviceId, use the Starfish devices API.