Testing REST Message getting 400 - Host name not sent?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2018 03:00 AM
Hi
This is on "Jakarta".
I am new to ServiceNow and trying to fire an Outbound REST message to our service but am getting
Response: Method failed: (/mybroker/updateIncident) with code: 400
I have stripped this right back and can get this same result running "Test" on a "GET" method the "REST Message" definition.
If I use an endpoint = "http://1.2.3.4" i.e. my IP address then (correctly) I get a 400 and I can see the request in our Web Server logs. Our server is configured to throw error if IP address only is specified.
If I use endpoint = "http://api.mycompany.com" I get the same error (400) and still see in base WebServer log - as though "Host" value isn't provided. I have tried adding that directly as an HTTP Header with same result.
I can get the page via a browser and Postman ok.
Is there some setting in the REST Message definition I am missing?
Thanks
David
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2018 03:05 AM
Hi David,
Can you try triggering the End Point in PostMan and confirm the HTML response?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2018 03:10 AM
Hi
for this test it's just returing a blank page at the moment - with response header as below. And (with PostMan) I can see the request hitting the correct Virtual Host in Reverse Proxy logs (for the host name provided)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2018 03:23 AM
If in postman the response is correct then go to REST Outbound and create your rest message over there and define your HTTP method and make sure the authentication profile is correct. Then this should work fine.
Thanks.
Dhruv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-13-2018 03:39 AM
Dhruv
I'm getting this error when running "Test" from the REST Outbound definition.
The authentication profile is set to "No Authentication" - which for this test is correct as this site doesn't expect it.
The issue (for me) is that ServiceNow doesn't seem to be providing (in my current setup) the "Host" details (from the Endpoint URL) for my web server to direct to the right virtual host.
I will try and capture the two requests arriving on my Reverse Proxy and see what headers are provided.