Invoking a WEB service in a stored procedure in SQL Server

Source: Internet
Author: User

Introduced

An old friend. Plan to develop an application that is based on. NET and sockets, but needs to invoke the WEB service in the stored procedure.

In this article we will share the experience of this application, how to invoke a Web service in a stored procedure, and pass parameters.

Step 1

First we create a WEB service project in Visual Studio:

Step 2

Next add the method we need in the service, where we create 6 methods, respectively,,, Greet (string Param1) , HelloWord() Add subtract and Divide (Num1 int, int num2)

Step 3

Then I started to create the stored procedure, and in all my articles I used the AdventureWorks database, which is my own test data project.

Step 4

Next, publish the Web service in IIS

Step 5

Then start coding the Access Web service in the stored procedure

Step 6

During the creation process, we pass a parameter, which is the parameter of the Waitingsaludar () method, if they want to use another method, should create another parameter, as I mentioned above other method, need two integral type parameter.

There are some things that are important when using the sp_OAMethod stored procedure, which waits for the post and GET methods, which by default is through the Post method, but if we use this method we will not be able to get to the XML output, so we must use the Get method here.

Step 7

Next we now test the Web service on the browser, open the URL http://localhost/WebServices/Service1.asmx , which shows all the methods that the Web service provides:

Step 8

Select the method we want to call and then enter the parameters to call

Step 9

When you're done with this, you'll open another page that contains the information and parameters in the XML

Step 10

Then we execute the stored procedure that we just created

Step 11

The following output is obtained after the call

Results

Here is the result, as it was called on the browser.

Invoking a WEB service in a stored procedure in SQL Server

Related Article

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.