I have a scenario where I need to access a WCF web service (locally hosted) from a SharePoint 2013 Visual Studio workflow. Below given is what I have done so far:

This is what the workflow does:

enter image description here

This is my Variables List

enter image description here

This is the message in the 1st WriteToHistory

enter image description here

This is the property window of 'BuildDynamicValue'

enter image description here

The HTTPSend activity and its propertie are shown below:

enter image description here

RequestHeaders Property of the WCF call

enter image description here

Final WriteToHistory's Message

enter image description here

The Code Behind of the WCF Services are shown below:

IService1.cs Data Contract

enter image description here

Service1.cs Method Implementation

enter image description here

DTOTest class

enter image description here

What Should Happen?: The 2nd WriteToHistory should write 'You Accessed the WCF service" message taken from the WCF service.

Please Help!

** ******UPDATE 1:****** **

I manage to get a REST web service running with methods using json. How can I get the values of a custom class object returned by the REST web service. This is what I get on the browser when I hit the web service uri.

{"GetDTOTestResult":{"DateTimeNow":"The DTOTest was returned at 9/15/2014 10:28:49 AM","Message":"Sample Message"}}

How can I get the DateTimeNow property via the GetDynamicValueProperties activity?

  • Are you getting any error?
    – Aanchal
    Commented Sep 10, 2014 at 9:12
  • @Aanchal No error.. The History list shows nothing written for the 2nd WriteToHistory
    – Muhammedh
    Commented Sep 10, 2014 at 9:26
  • I noticed in the 'RequestHeaders Property of the WCF call' you have the Method set to 'POST', should that be a 'GET'? Also, what happens if you try to hit the web service url directly from the browser? Commented Sep 10, 2014 at 10:16
  • @OmarStewey the 'GET' method did not work.. When I hit the web service url directly, I got a HTTP 400 Bad request error. However if i remove the '/GetDateTimeNow' part from the url and hit it. It works fine!
    – Muhammedh
    Commented Sep 10, 2014 at 11:35
  • Any thoughts guys???
    – Muhammedh
    Commented Sep 11, 2014 at 14:18

2 Answers 2


Found the solution... I had to mention


as the path for the property in the GetDynamicValueProperties activity.


Since this popped up again being refreshed by Community account, I want to summarize the general idea of what you need to do:

Workflow Side

  1. Use DynamicValue to represent a JSON object to be passed into a REST-service. Also, DynamicValue to receive return values from a REST-service.

  2. Use 'BuildDynamicValue' action to add properties to the DynamicValue workflow variable.

  3. Use 'GetDynamicValueProperties' to pull specific properties out from the DynamicValue workflow variable. This is also how you can walk the JSON object graph.

  4. In general, DynamicValue can not be logged easily to history, which has a tiny character limit of 255 characters. Try push them into a file in a document library for debugging. Or limit logging to first 250 characters.

  5. The property path is similar to XPath: Result/Value1

Service Side

  1. On WCF service side, use [WebGet] for GET requests. Use [WebInvoke] for POST requests.

  2. POST Requests are more suitable for multiple parameters, in which case, you want to wrap BodyStyle = WebMessageBodyStyle.WrappedRequest at least the Request.

    [WebInvoke(BodyStyle=WebMessageBodyStyle.WrappedRequest, UriTemplate="/GetHello", ...] string GetHello(string hello, string world);

Call it like this:

    url: '/GetHello', 
    data: { 
        'Hello': 'hello', 
        'World': 'world' 
  • WebMessageBodyStyle.WrappedRequest? I used Bare.
    – Muhammedh
    Commented Aug 19, 2015 at 5:44
  • Bare is fine if you are not passing arguments to the method. If you are calling [WebInvoke(BodyStyle = WebMessageBodyStyle.WrappedRequest, UriTemplate = '/GetHello', RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json] string GetHello(string hello, string world); Call it like this: POST { url: '/GetHello', data: { 'Hello': 'hello', 'World': 'world' } }
    – John Liu
    Commented Aug 19, 2015 at 8:02
  • This is how we did the method with 2 parameters.. Please check if it's ok or can it be better than this? [OperationContract] [WebGet( ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped, UriTemplate = "GetSupervisorGroupName/{employeeID}/{companyName}")] string GetSupervisorGroupName(string employeeID, string companyName);
    – Muhammedh
    Commented Aug 19, 2015 at 9:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.