I have a SP using MSXML2 to call a Web Service.
It is working on my local machine using SQL Server 2008R2
It is not working on my server, using SQL Server 2014.
Running the same MSXML2 from a Javascript program from the command line, works on both local machine and server.
The SQL Server service is running under an Admin user on both machines.
Here's the SQL:
Declare @Object as Int;
Declare @ResponseText as Varchar(8000);
Declare @Status as int;
Declare @Body as varchar(8000) =
'{"someParameterName": ["AAAAAAAA" ],"Message": "Here is a message I am sending","securityId": "DA6AC379-703F-4BCC-9B0B-8DBAF87EB5C6","type": "send_message"}'
Declare @BodyLength int = LEN(@Body)
Exec sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;
Exec sp_OAMethod @Object, 'setProxy', '2', 'http://localhost:8888',''
Exec sp_OAMethod @Object, 'open', NULL, 'post',
'https://api.theUrl.com/external/TheMessageApi',
'false'
Exec sp_OAMethod @Object, 'setRequestHeader', null, 'Content-Type', 'application/json'
Exec sp_OAMethod @Object, 'setRequestHeader', null, 'Content-LEngth', @BodyLength
Exec sp_OAMethod @Object, 'send', null , @Body
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
Exec sp_OAMethod @Object, 'status', @status OUTPUT
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
Select @ResponseText as Response, @Status as Status
Exec sp_OADestroy @Object
On my local machine I see the response text and status of 200
On the server I see Null, Null
I appreciate this is a bit specific - but I'm at a loss what else to look at!
I tried installing Fiddler - but that doesn't catch the traffic even when the call works!
Any advice gratefully received!