none
SharePoint 2013 Designer workflow - Second identical REST call returns XML and thus errors out. Why is this RRS feed

  • Question

  • I have a workflow defined on the Workflow Tasks list and I have a simple REST call to that same list and then I repeat the exact same REST call to that list and the first one works like a charm, the second one does not.  It Hangs and the error seems to imply the results are coming back via XML and not JSON.  Though the Dictionary, I've defined have the following structure,

    Accept    String    application/json;odata=verbose

    Content-Type     String     application/json;odata=verbose

    My original code actually had the second REST Call to a different List, but to debug, simplify, I used an exact copy.  I even put it into a different Stage to see if that made a difference.  I even used the exact same variables for the Call and tried using completely different variables.

    What is going on here?  Why is the second call which now is exactly coded as the first call returning as XML.  The message I get while it is hung up is: 

    RequestorId: 65d32ce8-525e-74ba-0000-000000000000. Details: 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 : 'application/atom+xml'. Content (truncated) : '<?xml version="1.0" encoding="utf-8"?><feed xml:base="https://share.health.wisconsin.gov/hc/teams/MES/_api/" xmlns="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml"><id>fd1431e7-4227-46b2-afcf-2f025ef99f7a</id><title /><updated>2019-05-21T16:07:30Z</updated><author><name /></author></feed>'. ResponseStatusCode : 'OK' Request Uri : 'https://xxx/hc/teams/MES//_api/lists/GetByTitle('Workflow Tasks')/Items?$select=Title&$filter=(Project_x0020_ID eq 'Sample1 23') and (TaskUID eq '0') and (PercentComplete ne 1)' at Microsoft.Activities.Messaging.SendHttpRequest.OnReceiveResponse(NativeActivityContext context, Bookmark bookmark, Object value) at System.Activities.Runtime.BookmarkWorkItem.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)

    Thank you


    Tuesday, May 21, 2019 4:33 PM

Answers

  • Ok, it all comes down to the fact that I had the wrong variable as defined by the Call,  The requestHeader was not in the appropriate place.  My bad.  I apologize to all who have wasted their time on this.
    • Marked as answer by SSHarvancik Friday, May 24, 2019 4:39 PM
    Friday, May 24, 2019 4:39 PM

All replies

  • Hi, 

    Try to confirm you could get correct data from browser by request the rest api first.

    siteurl/_api/lists/GetByTitle('Workflow Tasks')/Items?$select=Title&$filter=(Project_x0020_ID eq 'Sample1 23') and (TaskUID eq '0') and (PercentComplete ne 1)

    If you could get correct data, set the ResponseHeaders as json also.

    Here is one thread for your reference.

    https://prasadpathak.wordpress.com/tag/unable-to-deserialize-http-response-content/

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Wednesday, May 22, 2019 2:07 AM
  • I may not have been very clear.  The second REST call is identical to the first call.  The first call not only works in the workflow, it also works in the browser.  It just does not work when I call it the second time.

    My ResponseHeaders are set as JSON using the syntax I showed in the original post.  This is something different and it seems like it has to be a bug.  I was wondering if there was some parameter one can put in the select that might force the return to be JSON.

    Thanks

    Wednesday, May 22, 2019 1:40 PM
  • Hi,

    Could you remove first rest call to confirm it?

    Best Regards,

    Lee


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    SharePoint Server 2019 has been released, you can click here to download it.
    Click here to learn new features. Visit the dedicated forum to share, explore and talk to experts about SharePoint Server 2019.

    Thursday, May 23, 2019 9:08 AM
  • I coded the IF branches around it to based on a value to run the first or the second.  Trust me they both work when either of them run alone, but not in serial.  I'm a seasoned programmer.

    Ok, I created a new workflow with a single call and I get the same problem. I defined my Dictionary as: Accept and Content-Type of type String, values=application/json;odata=verbose.

    Then I add the call

    String=[%Workflow Context:Current Site URL%]/_api/lists/GetByTitle('EmailSetup')/Items?$select=Title

    RequestType=HTTP Get

    RequestHeaders: requestHeaders (dictionary)

    RequestContent: RequestContent (dictionary)

    ResponseContent: ResponseContent (dictionary)

    ResponseHeaders: ResponseHeaders (dictionary)

    ResponseStatusCode: ResponseCode (String)

    • Edited by SSHarvancik Friday, May 24, 2019 3:20 PM Another step in simplifying
    Thursday, May 23, 2019 3:48 PM
  • Ok, it all comes down to the fact that I had the wrong variable as defined by the Call,  The requestHeader was not in the appropriate place.  My bad.  I apologize to all who have wasted their time on this.
    • Marked as answer by SSHarvancik Friday, May 24, 2019 4:39 PM
    Friday, May 24, 2019 4:39 PM