wso2 / product-iots

Welcome to the WSO2 IoT Server source code! For info on working with the WSO2 IoT Server repository and contributing code, click the link below.
http://wso2.github.io/
Apache License 2.0
182 stars 181 forks source link

Arduino can't send messages to server via HTTP #1802

Open SiD86 opened 6 years ago

SiD86 commented 6 years ago

Description: When create an Arduino device and flash firmware to the device it, after power on the board in serial port I see the message bellow and other packets from/to the board are dropped.

<am:fault xmlns:am="http://wso2.org/apimanager"><am:code>404</am:code><am:type>Status report</am:type><am:message>Not Found</am:message><am:description>The requested resource (/endpoints/arduino_receiver?deviceId=u82wsofh28o4) is not available.</am:description></am:fault>

From IoT-Server.sh I see

[2018-03-22 17:34:51,362] [IoT-Core] ERROR - {org.apache.synapse.transport.passthru.SourceHandler} HttpException occurred
org.apache.http.ProtocolException: Invalid request line:
        at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:208)
        at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection$LoggingNHttpMessageParser.parse(LoggingNHttpServerConnection.java:383)
        at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection$LoggingNHttpMessageParser.parse(LoggingNHttpServerConnection.java:365)
        at org.apache.http.impl.nio.DefaultNHttpServerConnection.consumeInput(DefaultNHttpServerConnection.java:265)
        at org.apache.synapse.transport.http.conn.LoggingNHttpServerConnection.consumeInput(LoggingNHttpServerConnection.java:112)
        at org.apache.synapse.transport.passthru.ServerIODispatch.onInputReady(ServerIODispatch.java:82)
        at org.apache.synapse.transport.passthru.ServerIODispatch.onInputReady(ServerIODispatch.java:39)
        at org.apache.http.impl.nio.reactor.AbstractIODispatch.inputReady(AbstractIODispatch.java:113)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.readable(BaseIOReactor.java:159)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvent(AbstractIOReactor.java:338)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.processEvents(AbstractIOReactor.java:316)
        at org.apache.http.impl.nio.reactor.AbstractIOReactor.execute(AbstractIOReactor.java:277)
        at org.apache.http.impl.nio.reactor.BaseIOReactor.execute(BaseIOReactor.java:105)
        at org.apache.http.impl.nio.reactor.AbstractMultiworkerIOReactor$Worker.run(AbstractMultiworkerIOReactor.java:586)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.http.ParseException: Invalid request line:
        at org.apache.http.message.BasicLineParser.parseRequestLine(BasicLineParser.java:287)
        at org.apache.http.impl.nio.codecs.DefaultHttpRequestParser.createMessage(DefaultHttpRequestParser.java:119)
        at org.apache.http.impl.nio.codecs.DefaultHttpRequestParser.createMessage(DefaultHttpRequestParser.java:51)
        at org.apache.http.impl.nio.codecs.AbstractMessageParser.parseHeadLine(AbstractMessageParser.java:156)
        at org.apache.http.impl.nio.codecs.AbstractMessageParser.parse(AbstractMessageParser.java:206)
        ... 14 more

Affected Product Version: WSO2 Iot Server 3.2.0 Oracle JAVA 1.8.0_161

OS, DB, other environment details and versions:
Ubuntu Server 16.04.4 (4.4.0-116-generic #140-Ubuntu SMP) Arduino IDE 1.8.5, Adafruit CC3000 Library 1.0.3

Steps to reproduce:

  1. mvn clean install -f ./wso2iot-3.2.0/samples/device-plugins-deployer.xml

  2. ./wso2iot-3.2.0/scripts/change-ip.sh From "localhost" to "192.168.0.15"

  3. Start the server

    ./wso2iot-3.2.0/bin/broker.sh ./wso2iot-3.2.0/bin/iot-server.sh ./wso2iot-3.2.0/bin/analytics.sh

  4. Login to IoT Server (https://192.168.0.15:9443/devicemgt) with "admin"/"admin"
  5. Enroll device with type Arduino with name "Arduino"
  6. Download archive with firmware. Unzip it.
  7. In "ArduinoBoardSketch.h" set WLAN_SSID and WLAN_PASS. Flash it to Arduino Uno with CC3000 board.
  8. Power on Arduino.
SiD86 commented 6 years ago

And in Arduino firmware no any procedure to update security tokens. That is why in 1 hour after enrolling the new Adruino device token is expired.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity.

rasika commented 6 years ago

We didn't focus much on Arduino sample in the latest release. We'll focus on this in upcoming releases. We would really appreciate if you could fix it and send a PR as a contribution :)

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity.

shaheenk94 commented 5 years ago

I am facing a similar issue while enrolling the arduino device on WSO2 IoT Server 3.3.0. Has someone been able to resolve this issue as yet?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity.