I have a custom WCF REST service hosted in SharePoint. It is configured by MultipleBaseAddressWebServiceHostFactory in .svc file:
<%@ ServiceHost
Language="C#"
Debug="true"
Service="In2.Ilas.Sp.Ecase.Svc.PisarnicaService, In2.Ilas.Sp.Ecase, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ac775627f9c7b12a"
CodeBehind="Svc/PisarnicaService.cs"
Factory="Microsoft.SharePoint.Client.Services.MultipleBaseAddressWebServiceHostFactory, Microsoft.SharePoint.Client.ServerRuntime, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Service contract is defined as:
[ServiceContract]
public interface IPisarnicaService
{
[OperationContract]
Predmet2stIdentification CreateNew(string listName, int idPredmeta1st, string initiator);
}
Service implementation is as follows:
[WebInvoke(
Method = "POST",
ResponseFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "/CreateNew?listName={listName}&idPredmeta1st={idPredmeta1st}&initiator={initiator}")]
public Predmet2stIdentification CreateNew(string listName, int idPredmeta1st, string initiator)
{
SPUser user = SPContext.Current.Web.CurrentUser;
// ...
}
If I consume this service from webpart with ajax call then user variable will be filled with user who is currently browsing the webpart.
But if I consume same service from Workflow 2013 then user variable will be always filled with application pool account. I would like it to behave the same way as if it was called with ajax call, i.e. to have user variable filled with workflow initiator information. Currently, I am using a workaround where I send workflow initiator information as a string argument to web method.
HttpSend activity has RequestHeaders set up in this way:
Is there a way to automatically propagate workflow initiator information to custom WCF REST service?

0 commentaires:
Enregistrer un commentaire