Hello Community,
I am trying to write a new client for SAP Systems in ABAP.
I am quite new to communicating via http, especially when it comes to signed JSON strings.
My problem occurs when I try to send the http post method for creating a new account.
The Response is:"Unsupported Media Type"
"{# "type": "urn:ietf:params:acme:error:malformed",
'# "detail": "Invalid Content-Type header on POST. Content-Type must be "application/jose+json"",
'# "status": 415#}"
I already set the http Content-Type header field to 'application/jose+json'.
So there may be a Problem with how I formatted that json string.
Sadly I can't really figure out how it should exactly look like.
The Documentation says it has to be a flattened json serialisation which should look like:
{
"payload":"SW4gb3VyIHZpbGx--EXAMPLE--hZ2UsIGZvbGtzIHNheSBHb",
"protected":"ey--EXAMPLE--JhbGciOiJFUzI1NiJ9",
"header": { "kid": "myKey"},
"signature": "b7V--EXAMPLE--2UpDPytr-kMnM_YjiQ3E0J2ucOI9LYA7mt57vc"
}
which is an base64url encoding of:
@Payload:
{
"contact":["mailto:myadress@email.tld"]
}
@Protected:
{
"alg":"RS256",
"jwk":
{"kty":"RSA",
"n":"I6ICJFUzI1NiIsCiAgICAiandr",
"e":"xXbFQ5RUxQdkhGeVZTQ00iCiAgIC",
"use":"sig"},
"nonce":"0004rgVuSQ3wiyx7BL3blBhRdyuUNyVKT_UC9kXB6OWLwko",
"url":"https://example.com/acme/new-account"
}
@signature: Here I am not quite sure which exact data to throw into my function module for signing.
Please point out if I am doing something completely wrong.
I would really like if someone could give me some advices or even an example what exactly has to be sent.
Although is there good option to check whether the jose I have created is consistent or not?
Thank you so far