What is the error you are getting?
xml.setRequestHeader “Client-ID”, “MYSECRETCODEHERE”
This should be your Public Client ID. Not your Client Secret.
I see you are calling
Sometimes it just hiccups and you get a unexpected code. So the question is, what error are you geting