Client with http-server [message #1866807] |
Thu, 06 June 2024 21:16  |
Eclipse User |
|
|
|
Hello
I want to get and push parameters to a http-server . I build forte from source and activated http=on.
Sadly it's not actually working. My main problem is to set up the id right.
At the moment I only get NO_SOCKET or INVALID_ID as status
Can someone give me one example for get and one for push.
I'm also not sure if I have a bug.
Or are there another common mistakes.
In my test I just tried to read strings from the server.
Thank you all
Dustin
[Updated on: Thu, 06 June 2024 21:24] by Moderator
|
|
|
|
|
|
|
|
|
|
|
|
Re: Client with http-server [message #1866933 is a reply to message #1866852] |
Tue, 11 June 2024 01:25   |
Eclipse User |
|
|
|
I used now the develop version of forte. I also created a client_3_2 (3SD and 2RD). I was able to create a GET-communication with my server.
But the POST and PUT-requests doesn't work at the moment.
I created a Server who accepts all types of requests GET/POST/PUT. It worked if I did a curl request.
POST-request: curl -X POST http://localhost:8000/daten -H "Content-Type: application/json" -d "{\"name\": \"John\", \"alter\": 30, \"verheiratet\": true, \"haustiere\": [\"Hund\", \"Katze\"]}"
PUT-request: curl -X PUT http://localhost:8000/daten -H "Content-Type: application/json" -d "{\"name\": \"John\", \"alter\": 30, \"verheiratet\": false, \"haustiere\": [\"Hamster\"]}"
My main issue is that the json-data not correctly arrives. Some data is arriving certified trough the line: Empfangene Daten erhalten -b' '
But not the right one.
I can't copy my curl -body (json-string) directly because I would need double qoutes around my wstring-body, but every double quotes around e.g. "name" causes an issue.
With single quotes and backslashes I'm getting the same result.
I added in the files my used python http-server, my post & put request and my client configuration.
Thanks for your help
Dustin
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.49003 seconds