VMware Cloud Community
ganeshkanade
Contributor
Contributor

Issue: Error returned by expat parser: not well-formed (invalid token)

 

  1. This API is compatible with my vCenter version (You can get this info from the API documentation )
  2. I have searched existing issues

Similar issues with no (useful) answers:

Description

When trying to run any of the samples, I get a 500 server error:

ganeshkanade_1-1707379620522.png

This happens regardless of which sample I run. It happens during authentication as well as when directly invoking any of the services (after retrieving a session ID with the REST API).

I have been able to work with the same "endpoints" via both PowerCLI and the REST api.
I noticed that the PowerCLI is calling the same endpoint (myhostname.com/sdk) as the VIM JSON API, but PowerCLI sends XML whereas the VIM JSON API requires JSON. Pairing that with the error message, it seems that the server simply doesn't accept JSON.

Considering the at line 1, column 0 part of the message, I get the strong impression that the server simply does not like the JSON. That particular piece of the payload would be a < if it's XML or a { if it's JSON. I don't see any other reason why it would reject the very first character of the payload.

The request header does specify Content-Type: application/json. The administrator of our vSphere server believes the SDK should be using SOAP. I think it at least should be configurable.

0 Kudos
0 Replies