Symptoms
The client would like to call a REST web service. When he tries to pass any header I receive an error "VALIDATIONUnable to deserialize value HttpHeadere]"
The rest service is expecting the following information:
::Request::
HTTP Method / URI: https://URL/api/now/table/sys_user?
::Headers::
Accept application/xml
Content-Type application/xml
X-UserToken 9f94bb1ddbcb52007aa5f1eabf961968e26ce1d2345073c35acb28b1d36531d7296f0132
Diagnoses
I followed the following article to determine if the OData Service is compliant:
http://help.k2.com/onlinehelp/K2blackpearl/DevRef/current/default.htm_K2_OData_Service_Broker/Determine_Service_OData_Compliance.htm
When i test the OData Service in the "Add Service Reference" i get the following error:
The document at the url https://URL/api/now/table/sys_user? was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'XML Schema' is 'Data at the root level is invalid. Line 1, position 1.'.
- Report from 'DISCO Document' is 'Data at the root level is invalid. Line 1, position 1.'.
- Report from 'WSDL Document' is 'There is an error in XML document (1, 1).'.
- Data at the root level is invalid. Line 1, position 1.
Metadata contains a reference that cannot be resolved: 'https:// dlx.denallix.com /api/now/table/sys_user?'.
The remote server returned an unexpected response: (400) Bad Request.
The remote server returned an error: (400) Bad Request.
If the service is defined in the current solution, try building the solution and adding the service reference again.
Here is an additional article regarding this topic:
http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v3/calling-an-odata-service-from-a-net-client
Resolution
The client has indicated that he will be using SOAP in this instance.