关于Smartbi配置Sql Server数据源调用HTTP请求
要求利用存储过程调用http接口,并返回报表!笔记
1、开启Sql Server通讯配置
sp_configure 'show advanced options' , 1 ;
GO
RECONFIGURE ;
GO
sp_configure 'Ole Automation procedures' , 1 ;
GO
RECONFIGURE ;
GO
exec sp_configure 'Ole Automation Procedures' ;
GO
2、HTTP POST 请求函数
CREATE function [ dbo] . [ fn_http_post] (
@URL varchar ( 256 ) ,
@DATA varchar ( 2000 ) ,
@REQ_H_ACCEPT varchar ( 256 ) ,
@REQ_H_CONTENT_TYPE varchar ( 256 )
)
returns varchar ( 5000 )
as
BEGIN
DECLARE
@object int ,
@returnStatus int ,
@returnText varchar ( 5000 ) ,
@errMsg varchar ( 2000 ) ,
@httpStatus varchar ( 20 ) ;
exec @returnStatus = sp_oacreate 'MSXML2.ServerXMLHTTP.3.0' , @object OUT ;
if @returnStatus <> 0
BEGIN
exec SP_OAGetErrorInfo @object , @errMSg OUT