I am creating a custom Wcf service in sharepoint 2013
my code as below.
objectiveIntegration.svc
<%@ ServiceHost
Language="C#"
Debug="true"
Service="Technologies.Test.ObjectiveIntegration.Services.ObjectievIntegrationService, Technologies.Test.ObjectiveIntegration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=7d4eb69574ae9195"
CodeBehind="ObjectievIntegrationService.svc.cs"
Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory,Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral,
PublicKeyToken=71e9bce111e9429c" %>
Code Behind :
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
namespace Technologies.Test.ObjectiveIntegration.ISAPI.Technologies.Test.ObjectiveIntegration
{
[ServiceContract]
public interface IObjectIntegrationService
{
[OperationContract]
[WebInvoke(Method = "GET",
UriTemplate = "ObjectiveIntegrationGetList/{value}",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json)]
string GetUserPassedString(string value);
[OperationContract]
[WebInvoke(Method = "POST",
UriTemplate = "ObjectiveIntegrationUploadDoc/{webID}/{siteID}/{libraryID}/{itemID}",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json)]
bool DownloadDocument(string webID, string siteID, string libraryID, string itemID);
}
}
Calling service Contract from below
using Technologies.Test.ObjectiveIntegration.ISAPI.Technologies.Test.ObjectiveIntegration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;
using Microsoft.SharePoint;
namespace Technologies.Test.ObjectiveIntegration.Services
{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class ObjectievIntegrationService : IObjectIntegrationService
{
public string GetUserPassedString(string value)
{
return value;
}
public bool DownloadDocument(string webID, string siteID, string libraryID, string itemID)
{
bool isDocumentDownload = false;
try
{
// Get the SharePoint site collection from the given siteID.
using (SPSite objSite = new SPSite(Guid.Parse(siteID)))
{
if (objSite == null)
{
// To Do Message
}
else
{
using (SPWeb objWeb = objSite.AllWebs[Guid.Parse(webID)])
{
if (objWeb == null)
{
// To Do Message
}
else
{
// Get the Document library from the selected Web from specific Site.
SPList objList = objWeb.Lists[Guid.Parse(libraryID)];
if (objList == null)
{
// To Do Message
}
else
{
// Get listItem from the selected Document library from specific web in specific site.
SPListItem objListItem = objList.Items[Guid.Parse(itemID)];
if (objListItem == null)
{
// To Do Message
}
else
{
// Check List Item is file or folder.
if (objListItem.File == null)
{
// To Do Message
}
else
{
// To Do Code for upload
}
}
}
}
}
}
}
}
catch (ArgumentNullException ex)
{
throw ex;
}
catch (Exception ex)
{
throw ex;
}
return isDocumentDownload;
}
}
}
I have added "svc" refrence in csproject.
I have share point ISAPI mapped folder in solution.
Now when i calling from the _ti_bin folder service give me message that "End point not found". (http://Test11/sites/DemoTemplate/_vti_bin/Technologies.Test.ObjectiveIntegration/ObjectiveIntegrationServices.svc)
Please any one help me out.