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