I need to integrate the Autodesk PLM 360 service into SolidWorks and am using VBA to accomplish that. In order to initiate the HTTP requests, I am using the following code:
Dim objHTTP As MSXML2.ServerXMLHTTP
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP")
objHTTP.setRequestHeader "Content-Type", "application/xml" '<-- Error occurs here
objHTTP.Open "POST", "https://mytenant.autodeskplm360.net/rest/auth/1/login", False
objHTTP.send "<metaFields>" & _
"<password>MyPassword</password>" & _
"<userID>MyUserID</userID>" & _
"</metaFields>"
The third line from the above code trips the following error:
When I comment out the offending line, the status returned from the HTTP request is "415 - Unsupported Media Type".
Is there anyone that can make sense out of what the problem is here? All the searches I've done haven't helped at all.
P.S. I should also note that the same problem occurs in Excel too, so it isn't due to something strange that the SolidWorks implementation of VBA is doing.