Thanks for the hint. I found the problem and now the test was sussessfull with the code below. The problem was the syntax of my variable wsBEARERToken.
Code which works for me:
wsPOSTCommand := "{$"type$": $"uint32$", $"value$": 99}";
wsBEARERToken := "Authorization: Bearer eyJhbGciOiJFUzM4NCIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3MTIyNjM3NjMsImlhdCI6MTcxMjIzNDk2MywiaWQiOiIxMDAwIiwibmFtZSI6ImJvc2NocmV4cm90aCIsIm5vbmNlIjoiYjM0YWEyYjEtMWE1NC00YzU5LWJjMDktNzlmZDA3ZTRkZjE2IiwicGxjaGFuZGxlIjoyMjU0MzQ4NzI0MDMyOTE5Nzc2LCJyZW1vdGVhdXRoIjoiIiwic2NvcGUiOlsicmV4cm90aC1kZXZpY2UuYWxsLnJ3eCJdfQ.QRzUwVd8sGPn0-oa0qheO_C93aOCC7WwqDlcD3-3Gqajd4YWudPCTEQaTvyb5aF25tBRTSwjY-9lVzusJaFqqDQZ8UCri9IH8FsNcORuqjg6aIB7PVqE5ESmzBqPweGT";
// try to use a PUT command
fbWebClientPUT(
xExecute := ,
udiTimeOut := 1000000,
sURL := 'https://127.0.0.1/automation/api/v2/nodes/plc/app/Application/sym/GVL_Datalayer/dwTestDWORD',
eRequestType := WEB_CLIENT.REQUEST_TYPE.PUT,
eContentType := WEB_CLIENT.CONTENT_TYPE.APPLICATION_JSON,
pwsAdditionalHeader := ADR(wsBEARERToken),
pwsPostValue := ADR(wsPOSTCommand),
xCloseConnection := ,
hCert := ,
itfTLSContext := ,
itfAsyncProperty := ,
xDone => ,
xBusy => ,
xError => ,
eError => ,
httpResult => );
To use this functionblocks you need the additional CODESYS library (IIoT libraries) and a license. See this link.
Note: In demo mode, the software runs for 30 minutes without a license. After that, a manual restart is required.
... View more