Xojo.Net.HTTPSocket SetRequestContent as xml

Greetings,

Is there any special thing to do in order to send the data as a special XML format ?

what I do I have the data as text , then I have payload as memory block and I do

payload = TextEncoding.UTF8.ConvertTextToData(data)

then I use the authorization and all the header stuff then I do

initSocket.SetRequestContent(payload, "application/vnd.healthconnect.eforms.kmehr.integrator.v1+xml")

and post the data but on socket data received I get 406 Error and the message says

[quote]“code” : “media_type_not_supported”,
“description” : “Consult the documentation for all supported media types.”,[/quote]

but that is the exact content type that I use in postman and it works perfectly

so I guess then the issue might be the formatting of the xml from txt to the data conversion . So far the data I get it from xml.ToString so this looses the conversion or something ?

Thanks .

Just tested the content of the xml payload coming from the string as raw and it works on postman so I guess the issue is somewhere in the socket or I do something wrong .

Are you sure the most mime type is correct? Have you tried application/xml or text/xml ?

It may also be that you are not providing an Accept header:

[quote]406 Not acceptable
The resource is valid, but cannot be provided in a format specified in the Accept headers in the request.[/quote]

Well does not work if I put accept , if I leave the header without accept it works perfectly , if I put anything and the accept on header it fails with the same result, so this is not the issue here.

Here I did tried all the options in Postman , anything except that format in the content type does not work, but unfortunately nothing works on the socket.

If you’ll send me some sample code showing how you’re setting up the socket, I’d be happy to try it from here.

Hi Greg,

Unfortunately you cannot test it as the init token gets generated locally, but you can see the code, it has a lot of debugging points , I`ll send you a link on private as I cannot make it public.

Thanks.