Home > Microsoft SharePoint, SharePoint2013 > SharePoint 2013: Designer workflow error with ‘Call HTTP web service’ action

SharePoint 2013: Designer workflow error with ‘Call HTTP web service’ action

While working on one of the workflow development task, it was required to have a web service call to fetch data from SharePoint. To achieve that I used ‘Call HTTP web service’ action but with that I was getting following exception “Unable to deserialize HTTP response content. Expected Content Type: ‘application/json’, ‘text/plain’ or ‘text/html’”.

Suspended

After struggling with this issue, the solution I used thought to share the solution with developer community.

Solution: The reason for the issue is, by default response from SharePoint REST is in XML and SharePoint designer workflow not able to parse the xml and needs JSON response. To resolve this issue we need to pass Accept and Content-Type as application/json;odata=verbose to request headers. This way we will get JSON response. To resolve this follow bellow steps.

  1. Go to SharePoint 2013 designer.
  2. Build a Dictionary variable named ‘WSHearder’WF1
  3. Add two values in newly created dictionary
Accept = application/json;odata=verbose
Content-Type = application/json;odata=verbose
WF2
  1. Now select ‘Call HTTP web service’ action and select Properties.              WF3
  2. Select newly created dictionary variable as value for ‘RequestHeaders’.WF4
  3. Press OK and publish the workflow.
Advertisements
  1. December 20, 2015 at 10:32 am

    Nice Article but i have an issue concerning permission after applying your solution.

    My Exception details blew

    RequestorId: 00ae1285-ec80-e31b-0000-000000000000. Details: An unhandled exception occurred during the execution of the workflow instance. Exception details: System.ApplicationException: HTTP 401 {“error”:{“code”:”-2147024891, System.UnauthorizedAccessException”,”message”:{“lang”:”en-US”,”value”:”Access denied. You do not have permission to perform this action or access this resource.”}}} {“Transfer-Encoding”:[“chunked”],”X-SharePointHealthScore”:[“0″],”SPRequestGuid”:[“00ae1285-ec80-e31b-a9aa-ee07e9170033″],”request-id”:[“00ae1285-ec80-e31b-a9aa-ee07e9170033″],”X-FRAME-OPTIONS”:[“SAMEORIGIN”],”MicrosoftSharePointTeamServices”:[“15.0.0.4420″],”X-Content-Type-Options”:[“nosniff”],”X-MS-InvokeApp”:[“1; RequireReadOnly”],”Cache-Control”:[“max-age=0, private”],”Date”:[“Sat, 19 Dec 2015 14:47:36 GMT”],”Server”:[“Microsoft-IIS\/8.0″],”WWW-Authenticate”:[“NTLM”],”X-AspNet-Version”:[“4.0.30319″],”X-Powered-By”:[“ASP.NET”]} at Microsoft.Activities.Hosting.Runtime.Subroutine.SubroutineChild.Execute(CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager) at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

    So could you help me???

    • December 22, 2015 at 4:35 am

      Hi Amer,

      Normally SharePoint workflow run with the permission of the current user, who initiated the workflow unless you use ‘App step’. Please check that the current user have enough right to perform the action you are doing in workflow.

      Regards,
      Prasad Pathak

  2. has
    June 9, 2016 at 10:55 pm

    After adding the above steps i am getting the same error.

    An unhandled exception occurred during the execution of the workflow instance. Exception details: System.IO.InvalidDataException: Unable to deserialize HTTP response content. Expected ContentType : ‘application/json’, ‘text/plain’ or ‘text/html’, Received ContentType : ‘text/xml’. Content (truncated)

    Please help me here

  3. November 11, 2016 at 1:42 pm

    Thank you, man. It helps me a lot and it solved my problem! Thank you.

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: