Working code from Win2003 + SQL Server 2005 is not working under Win2012 + SQL Server 2012 sp1.
The only ~real solution I found is:
I copied C:\Windows\System32\msxml3.dll from a Server 2008 to the same dir on a server 2012. Problem on 2012 server solved, sending with POST and GET working fine.
But as I cannot modify server and both msxml3.dll and msxml6.dll are locked - I need to understand what is wrong and apply other way.
Code is simple as usual for grabbing soap web service:
Declare @Object as Int;
Declare @ResponseText as Varchar(8000);
Declare @ErrCode Int;
Exec sp_OACreate 'MSXML2.ServerXMLHTTP', @Object OUT;
Exec sp_OAMethod @Object, 'open', NULL, 'post','http://example.com/Authentication.asmx','false'
Exec sp_OAMethod @Object ,'setRequestHeader' ,NULL ,'Content-Type' ,'text/xml; charset=utf-8'
Exec sp_OAMethod @Object ,'setRequestHeader' ,NULL ,'SOAPAction' ,'"http://www.example.com/Login"'
Exec @ErrCode=sp_OAMethod @Object, 'send',null,'<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soap:Body>
<Login xmlns="http://www.example.com/">
<databaseName>db1</databaseName>
<userName>login</userName>
<password>pass</password>
</Login>
</soap:Body>
</soap:Envelope>'
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT
Select @ErrCode,@ResponseText
Exec sp_OADestroy @Object
I tried both MSXML2.XMLHTTP and MSXML2.ServerXMLHTTP (as well as .6.0 versions) objects.
Error id: -2147024809, with remark 'send' failed. The parameter is incorrect
.
Of course Ole Automation Procedures
is enabled.