WebRequest - Hello World sample not working in Eclipse

I am trying to get the WebRequest sample from the SDK working in Eclipse, without luck.

I use Eclipse Version: 2023-06 (4.28.0) with the latest SDK 6.2.1 and the WebRequest sample from SDK 6.2.1 The sample project builds without errors and open in the CIQ Simulator just fine. When the widget opens in the simulator, the screen on the device says ‘Press menu or select button’. When I press one of the buttons I get ‘Failed to load - Error 404’

If I copy the web address from the makeRequest function in the WebRequestDelegate.mc and paste it into Safari, the file is there with the following content:

{

  "userId": 6,

  "id": 115,

  "title": "sed et ea eum",

  "completed": false

}

If I generate the WebRequest.prg in Eclipse and drop it in the app folder on my Fenix 7, everything is fine. The widget works and I get:

{

  "userId": 6,

  "id": 115,

  "title": "sed et ea eum",

  "completed": false

}

when I press one of the buttons.

I guess something must be wrong with the Eclipse / Simulator setup on the Mac. Can anybody help ?

  • I tried this on Windows (VS Code) and it worked fine. Then I tried it on Mac (VS Code) and it failed in the same way you described.

    Probably worth filing a bug report.

  • I briefly dug in further and found that the simulator doesn't seem to use system proxy settings (this was also mentioned in the forums years ago), so I wasn't able to use a proxy debugging tool like https://proxyman.io/.

    However, I did use Wireshark (which captures packets) and found that the simulator is returning the following TLS error to the requested site (jsonplaceholder.typicode.com):

    TLSv1.2 Record Layer: Alert (Level: Fatal, Description: Unknown CA)

    My educated guess is that the simulator uses its own HTTP/HTTPS "browser" component with its own certificate store, and that certificate store doesn't recognize the certificate authority (Let's Encrypt) used by that site. (Obviously it loads fine in a web browser like Chrome, Safari or Firefox.)

    Unfortunately, changing the protocol from https to http results in a different error (-1001 / SECURE_CONNECTION_REQUIRED, returned by makeWebRequest itself, not the remote site), since HTTP is normally banned for non-local addresses. You can get around this by unchecking Settings > Use Device HTTPS Requirements in the simulator.

    Once I did both of those things (change "https" to "http" in the sample's makeWebRequest URL, and uncheck Use Device HTTPS Requirements in the simulator), I was able to get the sample to work on Mac

    EDIT: it's enough to uncheck "Use Device HTTPS Requirements" in the simulator. Changing the request protocol from https to http isn't necessary.)

  • Unchecking ‘Use Device HTTPS Requirements’ in the simulator, did the trick.

    Thank you for the answer.

  • No problem!

    Unchecking ‘Use Device HTTPS Requirements’ in the simulator, did the trick.

    You're right, it's enough to uncheck that option. It wasn't necessary to change the request protocol from https to http.

    I guess strict certificate validation is part of "device HTTPS requirements".