SQL 调用 webservice
webservice
需要配置为get 方式 sp_configure 'show advanced options', 1;
GO
RECONFIGURE;
GO
sp_configure 'Ole Automation Procedures', 1;
GO
RECONFIGURE;
GO
/********************************************/ declare @ServiceUrl as varchar(1000)
declare @UrlAddress varchar(500)
--WebService地址:以http开头,结尾带斜杠,例如'http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/'
set @UrlAddress = 'http://127.0.0.1/Service/MessageService.asmx/' declare @FunName varchar(50)
--WebService中调用的方法名:例如'getMobileCodeInfo'
set @FunName = 'SendMessage' --以下参数对应WebService中4个参数的[参数名]
DECLARE @appcode NVARCHAR(50)
DECLARE @password NVARCHAR(50)
DECLARE @sendModes NVARCHAR(50)
DECLARE @title NVARCHAR(50)
DECLARE @content NVARCHAR(50)
DECLARE @needReply VARCHAR(1)
DECLARE @bizObjId NVARCHAR(50)
DECLARE @senderUserID NVARCHAR(50)
DECLARE @receiveUserIds NVARCHAR(50)
DECLARE @receiveAcounts NVARCHAR(50)
DECLARE @sendTime DATETIME
DECLARE @expiredTime DATETIME SET @appcode=N'PersonalPortal'
SET @password=N'PersonalPortal'
SET @sendModes=N'%E7%9F%AD%E4%BF%A1'
SET @title=N'test'
SET @content=N'test'
SET @needReply='0'
SET @bizObjId=N'test'
SET @senderUserID=N'工号'
SET @receiveUserIds=''
SET @receiveAcounts='手机号码或邮件'
SET @sendTime=GETDATE()
SET @expiredTime=DATEADD(HOUR,1,GETDATE()) set @ServiceUrl = @UrlAddress + @FunName + '?appcode=' + @appcode +'&'
+ 'password=' + @password +'&'
+ 'sendModes=' + @sendModes +'&'
+ 'title=' + @title +'&'
+ 'content=' + @content +'&'
+ 'needReply=' + @needReply +'&'
+ 'bizObjId=' + @bizObjId +'&'
+ 'senderUserID=' + @senderUserID +'&'
+ 'receiveUserIds=' + @receiveUserIds +'&'
+ 'receiveAcounts=' + @receiveAcounts +'&'
+ 'sendTime=' + CONVERT(VARCHAR(50),@sendTime,120) +'&'
+ 'expireTime=' + CONVERT(VARCHAR(50),@expiredTime,120) PRINT @ServiceUrl Declare @Object as Int
Declare @ResponseText as Varchar(8000) Exec sp_OACreate 'MSXML2.XMLHTTP', @Object OUT;
Exec sp_OAMethod @Object, 'open', NULL, 'get',@ServiceUrl,'false'
Exec sp_OAMethod @Object, 'send'
Exec sp_OAMethod @Object, 'responseText', @ResponseText OUTPUT Select @ResponseText
Exec sp_OADestroy @Object
SQL 调用 webservice的更多相关文章
- SQL调用WebService接口
今天在做一个非常奇葩的东西.中间有个过程要在SQL触发器里面调用webservice接口.呵呵~ ALTER TRIGGER tgr_UpdateMemcached ON dbo.[User] AFT ...
- Sql调用WebService
DECLARE @scid int,@rt int ) --创建MSSOAP.SoapClient组件(如果安装的是SoapToolkit30,应该是MSSOAP.SoapClient30,否则是MS ...
- sqlserver能否调用webservice发送短信呢?
上班的时候突然有一个想法,sqlserver能否调用webservice发送短信呢? 经过查找资料,终于找到了解决办法,现将步骤贴到下面: (1)开启sqlserver组件功能,如果不开启这个组件功能 ...
- ASP.NET实现二维码 ASP.Net上传文件 SQL基础语法 C# 动态创建数据库三(MySQL) Net Core 实现谷歌翻译ApI 免费版 C#发布和调试WebService ajax调用WebService实现数据库操作 C# 实体类转json数据过滤掉字段为null的字段
ASP.NET实现二维码 using System;using System.Collections.Generic;using System.Drawing;using System.Linq;us ...
- SQL存储过程来调用webservice
如果用存储过程来调用webservice 那存储过程的功能感觉能做好多事情了? 别自欺欺人了.那些功能还是webservice来实现的... 完整的webservice代码:(也是默认的,新建.asm ...
- Jquery调用Webservice传递Json数组
Jquery由于提供的$.ajax强大方法,使得其调用webservice实现异步变得简单起来,可以在页面上传递Json字符串到Webservice中,Webservice方法进行业务处理后,返回Js ...
- .Net 下采用GET/POST/SOAP方式动态调用WebService的简易灵活方法(C#) [轉]Redfox
一直以来,我都为动态调用WebService方法而烦恼.在.Net环境下,最常用的方法就是采用代理类来调用WebService,可以通过改变代理类的Url属性来实现动态调用,但当xmlns改变时就会出 ...
- Ajax调用webService(一) 不跨域。
注:需要的js文件与组件(jquery-1.4.2.min.js和Newtonsoft.Json) 同域:要调用的webservice与ajax请求页面在同一个网站下(本文中都是本地测试). 数据库( ...
- 一个简单的webservice的demo(下)winform异步调用webservice
绕了一大圈,又开始接触winform的项目来了,虽然很小吧.写一个winform的异步调用webservice的demo,还是简单的. 一个简单的Webservice的demo,简单模拟服务 一个简单 ...
随机推荐
- 【BZOJ4281】[ONTAK2015]Związek Harcerstwa Bajtockiego LCA
[BZOJ4281][ONTAK2015]Związek Harcerstwa Bajtockiego Description 给定一棵有n个点的无根树,相邻的点之间的距离为1,一开始你位于m点.之后 ...
- 限制线程数 Limit the number of threads started by colly 随机延迟
random delay | Colly http://go-colly.org/docs/examples/random_delay/
- SAP FI 科目代码
资产类 现金 银行存款 其他货币资金 短期投资 短期投资跌价准备 应收票据 应收股利 应收利息 应收账款 其他应收款 坏账准备 预付账款 应收补贴款 物料采购 原材料 包装物 低值易耗品 材料成本差异 ...
- yum安装软件出错解决方法
造成yum下载安装时语法出错, 一般是由于python多个版本共存的原因.所以,只需将yum 设置文件固定python 版本,也就是python2 下面的操作能解决版本冲突问题. 1.sudo vim ...
- Ruby操作数据库基本步骤
1.rails g model university name:string 2.model has_many :colleges belongs_to :university has_one :us ...
- HDU - 2102 A计划 【BFS】
题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=2102 思路 题目有两个坑点 0.Output 说 能在T时刻 找到公主 就输出 YES 但实际上 只要 ...
- 51Nod 1158 全是1的最大子矩阵 —— 预处理 + 暴力枚举 or 单调栈
题目链接:http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1158 1158 全是1的最大子矩阵 基准时间限制:1 秒 空 ...
- LightOJ - 1321 Sending Packets —— 概率期望
题目链接:https://vjudge.net/problem/LightOJ-1321 1321 - Sending Packets PDF (English) Statistics Foru ...
- Mac OS 配置Maven
步骤: 1. 下载Maven tar包 https://maven.apache.org/download.cgi?Preferred=http%3A%2F%2Fmirrors.tuna.tsingh ...
- CATTI二级口译训练
Vice chancellor, faculty members and dear students, It is my great pleasure and privilege to visit C ...