我正在尝试使用SQL调用Web服务。 我可以正常调用Web服务,但是无法通过 @vResponseText和@vStatusText
中的Web服务进行响应SQL代码
Declare @vStatus Int,@vResponseText Varchar(Max), @vStatusText Varchar(Max),@WsUrl Varchar(Max),@vPointer Int,@Parametres varchar(1000)
set @Parametres = '?Param1=11&Param2=11'
SET @WsUrl = 'http://192.168.123.227:4569/ASTRAX_WebService.asmx/CallTestMethod' + @Parametres
EXEC sp_OACreate 'MSXML2.ServerXMLHTTP', @vPointer OUTPUT
EXEC sp_OAMethod @vPointer, 'open', NULL, 'GET', @WsUrl
EXEC sp_OAMethod @vPointer, 'send', NULL, @Parametres
EXEC sp_OAMethod @vPointer, 'responseText', @vResponseText OutPut
EXEC sp_OAMethod @vPointer, 'Status', @vStatus OutPut
EXEC sp_OAMethod @vPointer, 'StatusText', @vStatusText OutPut
EXEC sp_OADestroy @vPointer
Select @vStatus as Status, @vStatusText as StatusText, @vResponseText as ResponseText
网络服务代码
[WebMethod]
public string CallTestMethod(string Param1, string Param2)
{
return "I am called Successfully ..!!";
}
预期输出:
I am called Successfully ..!!