Figured out what the issue was. We have multiple domains on our server, and the account that was tied to the SOAP requests was on our old domain. The new domain had not yet been integrated with ServiceNow, and MSXML (what I was using to send the SOAP request) tried to do passthrough authentication with the new domain.
So, my next goal was to make sure MSXML was doing preemptive authentication, since this account using for SOAP requests was local to the ServiceNow server. I found something similar to my problem, so I tried the following:
- First, I ran the query in SOAPUI.
- Looking at the RAW tab, I pulled the "Authentication: Basic xxxxxx" header, and copied it directly into my code.
- I added the setRequestHeader to my request, and bam! It works.
Example code:
oWSRequest.open("POST", sEndpointURL, False, gServiceNowUser, gServiceNowPass)
oWSRequest.setRequestHeader("Content-Type", "text/xml")
oWSRequest.setRequestHeader("Authorization", "Basic c3J2Y1FsaWt2aWV3X09EQkM6bzc3MzQ4QTI4TnZV")
oWSRequest.send(oWSRequestDoc.xml)