How to build web service and push on sharepoint
Open visual studio 2010 | New Project
How to call web service by web part
On Web template, choose .NET Framework 3.5 from dropdownlist
then choose ASP.NET Web Service Application project and provide name is
HelloWorld
Structure of project as follows
Open Service1.asmx.cs and view default code
Typing F5 and click to method HelloWorld
Click Invoke
Result as follow
Right click Project | properties
Choose Category Application then click to button Assembly
information …
Fill full information, then click ok
Continue, choose category Signing
Check to checkbox “Sign the assembly” and choose new strong name key from dropdownlist below
Input name’s key file name and uncheck “Protect my key file
with a password”
Copy Dll in bin folder of your project (drag and drop to bin
folder to assembly folder)
After copy dll to here, right click to .dll | properties
Copy Public token key below and paste anywhere example
notepad
Open Service1 by notepad (Image 15)
You will see class as follows
HelloWord,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=140f54b64af2de0f”
in class as follow
Copy service1 to folder “C:\Program Files\Common
Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\LAYOUTS” as follows
How to call web service by web part
New Visual Webpart
Copy this segment code to Page_Load event as follows:
HelloWordService.Service1 helloWord = new HelloWordService.Service1();
Literal1.Text= helloWord.HelloWorld();
HelloWordService.Service1 helloWord = new HelloWordService.Service1();
Literal1.Text= helloWord.HelloWorld();
Build and deploy project you will meet error
Go to Central Admin |
click to “Manage web applications” link then click to your web application – On
ribbon choose Icon Authentication Provides ( Image 35)
Site Actions | Site Settings | Site Permissions