Objective: to return XmlDocument from WCF REST WebService via URL.
Creating a WCF WebService is straight forward, but to create a WCF WebService to host under SharePoint 2010 you need extra steps to accomplish.
This is my first time to develop WCF RestFul WebService. Many of you may familiar with REST if you are the SharePoint Developer.
I will attach a zip file of a working solution at the end of this post.
To Create WCF Service
- New Project -> WCF -> WCF Service Library
- it will create 2 class files for you. (we need these 2 files)
To Create SharePoint WCF Service
- New Project -> SharePoint -> Empty SharePoint Project
- Map ISAPI SharePoint Folder
- Create a text file and rename it to “BuckOfficesService.svc”
- Create another text file and rename it to “web.config”
- Copy 2 cs files from WCF Service Project (Rename them as BuckOfficeService.cs and IBuckOfficesService.cs)
- Make sure those references added in the project as well
- Microsoft.SharePoint
- Microsoft.SharePoint.Client.Runtime
- Microsoft.SharePoint.Security
- System.ServiceModel
- System.ServiceModel.Web
So I wanted to return a XmlDocument from Rest WCF WebService.
You need to make sure you add [XmlSerializerFormat] in your Interface class (it will return error when you try to run the service) before or after [ServiceContract]
Deploy the solution to your SharePoint Server.
Launch IE with http://localhost/_vti_bin/buckofficesservice.svc/getbuckoffices

You may download the full working source code for HTTP only [here]
To cater for HTTPS, you need to add extra line in web.config (those red highlighted)
Click the image for better view

Incoming search terms:
- sharepoint 2010 custom web service rest return xml
- wcf rest xmldocument
- sharepoint 2010 webservice return xml
- sharepoint web service endpoint documents
- sharepoint with wcf rest
- unable to return xmldocument from wcf
- asp net xml webservice return int
- wcf return xmldocument
- wcf service return xmldocument
- wcf to send xml document




