Error with simple HTTP Request
Answer
10/10/18 1:51 PM

Hello, 

i tried the simple http request example from https://developer.appropos.de/xdk/protocols/http/

Using it as is, i got a response

INFO | XDK DEVICE 1: HTTP RESPONSE: 503 [text/html]
 INFO | XDK DEVICE 1: <html><body><h1>503 Service Unavailable</h1>
 INFO | XDK DEVICE 1: No server is available to handle this request.
 INFO | XDK DEVICE 1: </body></html>

 

Changing line 

Ip_convertOctetsToAddr(23, 22, 14, 18, &destAddr);

to 

Ip_convertOctetsToAddr(192,168,178,25, &destAddr);

which is a local server just returning "Hallo Welt"

results in

Failed to send HTTP request!

I extended the script at this particular line by

Retcode_RaiseError(status);

and it results in 

INFO | XDK DEVICE 1: Failed to send HTTP request!
 INFO | XDK DEVICE 1: Error in Unclassified package.
 INFO | XDK DEVICE 1: 	Package ID: 0	Module ID: 0	Severity code: 0	Error code: 1357

 

Any help appreaciated

 

kind regards

sven

0 (0 Votes)
RE: Error with simple HTTP Request
Answer
10/11/18 3:19 PM as a reply to Sven Kabitzki.
Hello Sven,

Due to your earlier HTTP response 503, which means the XDK was able to send a request, your code seems to be fine. Furthermore, the return code 1357 stands for RC_HTTP_SEND_ERROR which is listed within the file Serval_Exceptions.h .

In that regard, can you ensure that your local web server is connected to the same Wi-Fi network with the XDK? Additionally, did you test, if your local web server is reachable with another client except the XDK?

Please note, that your XDK needs to be connected to the same Wi-Fi network like your local web server and that the web server is reachable and ready to listen to requests.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: Error with simple HTTP Request
Answer
10/15/18 8:54 AM as a reply to Franjo Stjepandic.

Hello Franjo, 

 

thanks for your response. 

>In that regard, can you ensure that your local web server is connected to the same Wi-Fi network with >the XDK? Additionally, did you test, if your local web server is reachable with another client except the >XDK? 

I have a Hotspot configured on my laptop to which the xdk connects. 

Via this connection the first request (the sample) works.

the second request to a local xampp apache webserver doesnt. The xampp apache runs on the same laptop (its a complete local installation).

a third request to an inubit installation within a connected network doesnt work too. 

All Webservers are reachable by the laptop where the hotspot is configured to to which the xdk is connected. 

 

any suggestions ??

kind regards

sven

0 (0 Votes)
RE: Error with simple HTTP Request
Answer
10/15/18 3:07 PM as a reply to Sven Kabitzki.
Hello Sven,

thank you for getting more into detail.

On that behalf, could you share additional information about your method to test if the first request goes through? Do you use a timer task to send requests periodically or do you use only one request at all?

To establish a connection to your XAMPP apache server, which runs on your laptop, an additional configuration might be necessary, such as the host header. This could also come to play for the Inubit installation.

Furthermore, I assume you tried to reach the web servers with the same laptop that opens the hotspot? If this is true, is there a possibility to try a scenario with a third client?

Kind regards,
Franjo
0 (0 Votes)
RE: Error with simple HTTP Request
Answer
11/8/18 10:29 AM as a reply to Franjo Stjepandic.

Hello Franjo, 

so, i was away a short time, handling other things. :-) 

Now i am back to XDK.

So, a simple HTTP Request now works but i have, maybe a small problem with the cloud connectivity showcase.

 

After figuring out, that the config file needs a linebreak at the end of the file, otherwise it will run in an infinity loop 

(line 342 in AppTxtParser.c)

while (
            (buffer[*idxAtBuffer] != '\r') &&
                    (buffer[*idxAtBuffer] != '\n') &&
                    (buffer[*idxAtBuffer] != '\t') &&
                    (buffer[*idxAtBuffer] != ' ') &&
                    (buffer[*idxAtBuffer] != '=') &&
                    (*idxAtBuffer < bufSize)
            )

i got the following messages in the logging console: 

INFO | XDK DEVICE 1: WLAN_Enable : Preparing for Personal WPA2 connection
 INFO | XDK DEVICE 1: This is a CC3100R device
 INFO | XDK DEVICE 1: CHIP 0x4000000
 INFO | XDK DEVICE 1: MAC 31.1.2.0.2
 INFO | XDK DEVICE 1: PHY 1.0.3.23
 INFO | XDK DEVICE 1: NWP 2.2.0.1
 INFO | XDK DEVICE 1: ROM 0x3333
 INFO | XDK DEVICE 1: HOST 1.0.1.6
 INFO | XDK DEVICE 1: WLANPersonalWPA2Connect : Connecting to GELABSH 
 INFO | XDK DEVICE 1:  Connected to WPA network successfully
 INFO | XDK DEVICE 1: IP address of device  192.168.137.197
 INFO | XDK DEVICE 1:               Mask    255.255.255.0
 INFO | XDK DEVICE 1:               Gateway 192.168.137.1
 INFO | XDK DEVICE 1:               DNS     192.168.137.1
 INFO | XDK DEVICE 1: WLANPersonalWPA2Connect : Connected to WPA network successfully. 
 INFO | XDK DEVICE 1: srand(1587)
 INFO | XDK DEVICE 1: FOTA_EVENT_PARTITION_AGENT_INIT_OK 
 INFO | XDK DEVICE 1: LWM2M_Enable : with DTLS (PSK) 
 INFO | XDK DEVICE 1: AppControllerFire 1
 INFO | XDK DEVICE 1: AppControllerFire 3
 INFO | XDK DEVICE 1: SntpSentCallback : Success
 INFO | XDK DEVICE 1: Error in ServalPAL package.
 INFO | XDK DEVICE 1: 	Package ID: 30	Module ID: 31	Severity code: 2	Error code: 8
 INFO | XDK DEVICE 1: AppControllerFire : SNTP server time was not synchronized for '1' time. Retrying...
 INFO | XDK DEVICE 1: SntpSentCallback : Success
 INFO | XDK DEVICE 1: SntpTimeCallback : received
 INFO | XDK DEVICE 1: LWM2M server resolved: coaps://52.29.220.52:5684
 INFO | XDK DEVICE 1: WLAN: connect status: --- online ---
 INFO | XDK DEVICE 1: Try refresh registration ENABLED (49 sec)
 INFO | XDK DEVICE 1: ==> registration retry
 INFO | XDK DEVICE 1: ==> Waiting for successful registration 1!
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 60 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 12 sec)
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 80 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 32 sec)
 INFO | XDK DEVICE 1: LWM2MApplicationCallback : Serval Stack Error Code : M=0x09, E=0x0B, S=0x1 (0x094B)
 INFO | XDK DEVICE 1: registration failed M=0x09, E=0x0B, S=0x1 (0x094B)
 INFO | XDK DEVICE 1: AppLWM2MStatusNotificationCB : Registration failed 
 INFO | XDK DEVICE 1: LWM2M server resolve started: coaps://lwm2m.eu-1.bosch-iot-suite.com:5684
 INFO | XDK DEVICE 1: DNS lookup coaps://lwm2m.eu-1.bosch-iot-suite.com:5684
 INFO | XDK DEVICE 1: DNS resolved coaps://52.29.220.52:5684, time 120 ms
 INFO | XDK DEVICE 1: LWM2M server resolved: coaps://52.29.220.52:5684
 INFO | XDK DEVICE 1:    ENABLED (since 100 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 19 sec)
 INFO | XDK DEVICE 1:    ENABLED (since 120 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 39 sec)

So, to me, it looks like, config is fine, wlan is working, and Cloud can be reached but somethign is wrong with the registration of the device. 

Can you give me some guidance ??

 

kind regards

sven

0 (0 Votes)
RE: Error with simple HTTP Request
Answer
11/9/18 3:40 PM as a reply to Sven Kabitzki.
Hello Sven,

The error you are received might be an authorization issue. Furthermore, the error code 0x09 is pointing to RC_LWM2M_METHOD_UNAUTHORIZED .
I assume you are trying to connect to the Bosch IoT cloud.

If that is correct, I would ask you to create a new thing there with a new config file and add the line break at the end and configure your Wi-Fi credentials into it. In addition, please use a new unmodified version of the BoschXDKCloudConnectivity example. Afterwards, try the new configuration with the example once more.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: Error with simple HTTP Request
Answer
11/12/18 11:58 AM as a reply to Franjo Stjepandic.

Hello Franjo, 

The error you are received might be an authorization issue. Furthermore, the error code 0x09 is pointing to RC_LWM2M_METHOD_UNAUTHORIZED .
I assume you are trying to connect to the Bosch IoT cloud.

Yes, thats true. I trie to connect to the Bosch IoT Cloud. 

So, i did what you suggested

- registered a new THING

- edited the config file with my WLAN Credentials

- added the linebreak at the end ;-) 

and used a new unedited version of the BoschXDKCloudConnectivity eample

Sadly there is no difference in the result.

do you have another idea ??

kind regards

sven

0 (0 Votes)
RE: Error with simple HTTP Request
Answer
11/12/18 5:06 PM as a reply to Sven Kabitzki.
Hello Sven,

Unfortunately, I was not able to recreate your issue. I got the connection to IoT Things established by using the latest XDK-Workbench 3.4.0, the latest BoschXDKCloudConnectivity example and by following the official tutorial .

Did you follow the tutorial above and generated your very own config.txt file (8 lines short) out of the IoT Things registration page and saved this onto your SD card?
This is necessary to use to connect with the BoschXDKCloudConnectivity example to the IoT Things.

Keep in mind, you do not need to edit anything within the BoschXDKCloudConnectivity example at all.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: Error with simple HTTP Request
Answer
12/4/18 11:25 AM as a reply to Franjo Stjepandic.

Okay, 

now i have a new Problem. 

With XDK Workbench 3.5.0 64-bit and the default BoschXDKCloudConnectivity i got:

 

Creating Firmware Over the Air (FOTA) Container
 INFO | Binary File: C:\Users\kabitzki\XDK-Workspace\BoschXDKCloudConnectivity\debug\BoschXDKCloudConnectivity.bin
 INFO | Header Version: 0100
 INFO | Product Class: 0010
 INFO | Product Variant: 0000
 INFO | Firmware Version: 00000000
 INFO | Flashing file 'C:/Users/kabitzki/XDK-Workspace/BoschXDKCloudConnectivity/debug/BoschXDKCloudConnectivity.bin'...
 INFO | Flashing aborted due to not supported firmware size for XMODEM file transfer.
	The supported size for this Bootloader is 614400 Bytes.
	Size of C:/Users/kabitzki/XDK-Workspace/BoschXDKCloudConnectivity/debug/BoschXDKCloudConnectivity.bin is 789272 Bytes.
	Please have a look into the documentation. 

 

 

 

 

 

 

0 (0 Votes)
RE: Error with simple HTTP Request
Answer
12/4/18 3:56 PM as a reply to Sven Kabitzki.
Dear Sven,

I was able to reproduce your error. The error message you are receiving is implying that the project was build for the Bootloader 1.2.0 instead of the Bootloader 1.1.0. Unfortunately, I did not found any clue where to change the setting effectively to build the binary for the Bootloader 1.1.0.

As such, I can only recommend upgrading the Bootloader of your XDK to the Bootloader Version 1.2.0. For that, you would need to connect your XDK to your notebook/pc via a debugger such as the J-Link Lite , while the XDK-Workbench is open. Then you can right-click the XDK and use the option Flash Bootloader to flash the Bootloader 1.2.0.

Furthermore, please note if you intend to order the J-Link lite to contact the SEGGER sales team and tell them that you are ordering it for the XDK. This is necessary because the J-Link lite is not sold exclusively.

Please let me know if this was helpful and feel free to ask if you have further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: Error with simple HTTP Request
Answer
12/12/18 2:17 PM as a reply to Franjo Stjepandic.

Hello Franjo, 

so, updated Workbench Version to 3.5.0 and Bootlader with JLink to 1.2.0.

Registered a new THING in cloud. Updated the config file on the sd card.

Now i got this: 

INFO | XDK DEVICE 1: LWM2M server resolve started: coaps://lwm2m.eu-1.bosch-iot-suite.com:5684
 INFO | XDK DEVICE 1: DNS lookup coaps://lwm2m.eu-1.bosch-iot-suite.com:5684
 INFO | XDK DEVICE 1: DNS resolved coaps://52.29.220.52:5684, time 119 ms
 INFO | XDK DEVICE 1: LWM2M server resolved: coaps://52.29.220.52:5684
 INFO | XDK DEVICE 1:    ENABLED (since 160 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 19 sec)
 INFO | XDK DEVICE 1:    ENABLED (since 180 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 39 sec)
 INFO | XDK DEVICE 1: Try refresh registration ENABLED (192 sec)
 INFO | XDK DEVICE 1: ==> registration retry
 INFO | XDK DEVICE 1:   . Setting up the SSL/TLS structure...==> Waiting for successful registration 2!
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 200 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 59 sec)
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 220 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 79 sec)
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 240 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 99 sec)
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 260 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 119 sec)
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 280 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 139 sec)
 INFO | XDK DEVICE 1:    REGISTER PENDING (since 300 sec, lifetime 240 sec)
 INFO | XDK DEVICE 1:    DNS RESOLVED (since 159 sec)
 INFO | XDK DEVICE 1: failed  ! mbedtls_ssl_handshake returned -0x6800MyHandshake break 
 INFO | XDK DEVICE 1:        315 [EXH:2] M=0x03, E=0x09, S=0x2 (0x0389)
 INFO | XDK DEVICE 1:        315 [EXH:2] M=0x03, E=0x09, S=0x2 (0x0389)
 INFO | XDK DEVICE 1: LWM2MApplicationCallback : Serval Stack Error Code : M=0x09, E=0x0B, S=0x1 (0x094B)
 INFO | XDK DEVICE 1: registration failed M=0x09, E=0x0B, S=0x1 (0x094B)
 INFO | XDK DEVICE 1: AppLWM2MStatusNotificationCB : Registration failed 

Do you have any idea ? :-) 

 

kind reagards

sven

0 (0 Votes)
RE: Error with simple HTTP Request
Answer
12/12/18 4:42 PM as a reply to Sven Kabitzki.
Hello Sven,

the issue with your flashed BoschXDKCloudConnectivity example is, that the mbedtls_ssl_handshake is failing. The return code of this function call is corresponding to 0x7780 MyHandshake break. According to the mbed TLS documentation , this error means that you received a fatal alert message from the server.

Furthermore, the message 34 [EXH:2] M=0x03, E=0x09, S=0x2 (0x0389) from the Serval Stack is pointing to an invalid UDP socket .

However, I tested the BoschXDKCloudConnectivity example by myself and was, unfortunately, not able to reproduce your issue. In that regard, I would recommend checking if the SD card has anykind of black lines after the credentials and give it another try.

Please tell me if this was helpful, and do not hesitate to ask further questions.

Kind regards,
Franjo
0 (0 Votes)
RE: Error with simple HTTP Request
Answer
12/18/18 10:32 AM as a reply to Franjo Stjepandic.

Hello Franjo, 

i am really thankful for your support. 

i tried to check the config.txt file. i cannot find anything strange in there. 

i opened a ticket at Bosch-SI Support - maybe they have an idea why this error occurs. 

for myself i will continue to search for the error.

for that, thank you for your support regarding understanding error messages https://xdk.bosch-connectivity.com/community/-/message_boards/message/434855 

i´ll try to dive deeper into this ;-) 

kind regards

sven

 

0 (0 Votes)
RE: Error with simple HTTP Request
Answer
12/18/18 3:59 PM as a reply to Sven Kabitzki.
Hello Sven,

I am always glad to help.
I will also take another look at the issue.

In addition, please keep me updated on your results.

If you have any questions, feel free to ask.

Kind regards,
Franjo
0 (0 Votes)