SQL Call Web Service

Source: Internet
Author: User

Basic stored procedures:
/****** object:storedprocedure [dbo]. [Spcallboservice] Script date:11/19/2015 16:45:14 ******/
SET ANSI_NULLS on
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo]. [Spcallboservice]
(
@Url NVARCHAR (MAX) = ' http://192.168.0.151:8085/BillService.asmx/',
@MethodName VARCHAR = ' HelloWorld ',
@Parameters NVARCHAR (MAX) = ",
@result VARCHAR (MAX) out
)
As
DECLARE @obj INT
DECLARE @ValorDeRegreso INT
DECLARE @response VARCHAR (8000)
SET @Url = @Url + @MethodName
IF LEN (@Parameters) > 0
BEGIN
SET @Url + = '? ' + @Parameters
END
PRINT @Url
EXEC sp_OACreate ' msxml2.xmlhttp ', @obj out
EXEC sys.sp_oamethod @obj, ' Open ', NULL, ' Get ', @Url, False
EXEC sp_OAMethod @obj, ' send '
EXEC sys.sp_oagetproperty @obj, ' responsetext ', @response out
SET @result = @response
EXEC Sys.sp_oadestroy @obj


How to use:
/****** object:storedprocedure [dbo]. [Sp_callsynfailuresendmcodetomticket] Script date:11/19/2015 16:48:30 ******/
SET ANSI_NULLS on
GO
SET QUOTED_IDENTIFIER ON
GO
--Author: Zeng Tim Lee
--Create date:2015-11-18
--Description: Timed sync big turntable m coupon system failed m coupon
-- =============================================
CREATE PROCEDURE [dbo]. [Sp_callsynfailuresendmcodetomticket]
As
BEGIN
DECLARE @result NVARCHAR (1000)
EXEC dbo.spcallboservice @Url = N ' http://192.168.0.37:8080/WebService.asmx/',--nvarchar (max)
@MethodName = ' executecontrolfunction ',--varchar (50)
@Parameters = N ' paramjson=["MyjWeiXin.Controllers.Activity.Roulette.RoulettePage", "Synfailuresendmcodetomticket" ] ',--nvarchar (max)
@result = @result OUTPUT-varchar (max)
PRINT @result

END

SQL Call Web Service

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.