Using a web service in SharePoint InfoPath form

Consume Web Service in InfoPath Form

1. Create a folder in inetpub/wwwroot directory of your system drive. (in this screen “InfoPWebService).




2. Create a new website in IIS and give the physical path of above folder and provide a port number (Please refer below screen shot).




3. Assign the correct application pool which you have right to read, write, execute (i.e. full control).




4. Create a table in SQL server called “student”.
5. Add 2 fields firstname and lastname.
6. Create a new ASP.Net web service in visual studio. (see below screen, give a name like below with port no. that you gave in IIS).




7. Remove the existing [webmethod] and write below code (Or write your code to add a user in SQL DB.




8. Once you wrote the code build the solution and browse your service. (Test whether your service is working or not).

9. Once you will invoke the service, you will get the result message. (If you have given in code). 


10. Also same data should be inserted to table “student”.
11. Now open infopath and create a new form template (web service). Refer below screen.

                                   


12. Select submit data and click next.
13. Enter the service url.(You can browse service from visual studio and get the url).

                                  


14. Select your operation name and click next. Again leave data connection name as it is and click finish.
15. Once infopath form will be open drag the fields from right side pane (see below screen).

                                 
16. Drag and select “Controls in Layout table”.

                                    
17. Click on preview, enter the sample data and click on submit. Now, go and check your db the data should be there.



18. If you want to publish this infopath form then, select File->Publish and follow the steps.

Comments

Popular

C# 6.0 New Features

SharePoint Interview Questions and Answers

Calling ASP.Net WebMethod using jQuery AJAX

What is Cloud Computing - A guide for beginners