SQL Call WebService

Source: Internet
Author: User
Tags getdate

WebService
Need to be configured as Get mode

sp_configure ' show advanced options ', 1; Goreconfigure; Gosp_configure ' Ole Automation procedures ', 1; Goreconfigure; Go/********************************************/declare @ServiceUrl as varchar (declare @UrlAddress varchar (500 --webservice address: Starts with HTTP and ends with slashes, such as ' http://webservice.webxml.com.cn/WebServices/MobileCodeWS.asmx/' set @UrlAddress = ' http://127.0.0.1/Service/MessageService.asmx/' Declare @FunName the method name called in varchar (--webservice): for example ' Getmobilecodeinfo ' Set @FunName = ' SendMessage '--the following parameters correspond to the [parameter name]declare of the 4 parameters in WebService @appcode NVARCHAR () DECLARE @ Password NVARCHAR () DECLARE @sendModes NVARCHAR () DECLARE @title NVARCHAR () DECLARE @content NVARCHAR () DECLARE @ Needreply VARCHAR (1) DECLARE @bizObjId NVARCHAR () DECLARE @senderUserID NVARCHAR (@receiveUserIds DECLARE) NVARCHAR ( DECLARE @receiveAcounts NVARCHAR () DECLARE @sendTime datetimedeclare @expiredTime datetimeset @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 ' work number ' set @receiveUserIds = ' SET @ Receiveacounts= ' mobile number or mail ' 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 + ' & ' + ' Receiveaco Unts= ' + @receiveAcounts + ' & ' + ' sendtime= ' + CONVERT (VARCHAR (+), @sendTime, +) + ' & ' + ' expiretime= ' + CON VERT (VARCHAR, @expiredTime,) PRINT @ServiceUrl Declare @Object as intDECLARE @Resp Onsetext 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_oadest Roy @Object

SQL Call WebService

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.