【发布时间】:2014-11-05 19:48:18
【问题描述】:
Win2003 + SQL Server 2005 的工作代码在 Win2012 + SQL Server 2012 sp1 下不起作用。
我找到的唯一~realsolution是:
我将 C:\Windows\System32\msxml3.dll 从 Server 2008 复制到同一个 2012 年服务器上的目录。2012 年服务器上的问题已解决,使用 POST 发送 并且 GET 工作正常。
但是由于我无法修改服务器并且 msxml3.dll 和 msxml6.dll 都被锁定 - 我需要了解问题所在并以其他方式应用。
获取soap web服务的代码很简单:
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
我尝试了 MSXML2.XMLHTTP 和 MSXML2.ServerXMLHTTP(以及 .6.0 版本)对象。
错误 ID:-2147024809,带有备注“发送”失败。 The parameter is incorrect。
当然Ole Automation Procedures 已启用。
【问题讨论】:
-
这件事你有成功吗?我现在有同样的问题。
-
@VictorViola 很遗憾没有(
标签: sql tsql soap sql-server-2012 ole