Why is the Web Service Response Content Collection is Storing Each Character as an Item?

  • 2 November 2017
  • 3 replies
  • 7 views

Userlevel 6
Badge +12

Hello All - 

I am working on a process where I am making multiple web service calls and pulling out bits of data to pass along to the next web service call. We can do this within Nintex Workflow for Office 365, but want to explore the possibilities using NWC.

When I call the web service, my Response content Collection variable does contain data (JSON), but for some reason it is storing each character as an item in the collection

Here is my workflow and actions (just focusing on the first call):

210344_pastedImage_12.png

Web ServiceCount itemsSend Email
210341_pastedImage_9.png210342_pastedImage_10.png210343_pastedImage_11.png

Email:

Response Code: 200
Response Content: {"result":{"credentials":{"database":"xxxxxxxxxxxxx","sessionId":"4733467139606425463","userName":"xxxxxxxxxx@duqlight.com"},"path":"ThisServer","securityToken":{"database":"xxxxxxxxxxxxx","sessionId":"4733467139606425463","userName":"xxxxxxxxxx@duqlight.com"}},"jsonrpc":"2.0"}
Collection Count: 278

Check on Collection character count:

210345_pastedImage_14.png

Within Nintex Workflow for O365, I would simply put the response in a dictionary and be able to target the sessionId like so:

210346_pastedImage_15.png

...but that does not exist within NWC, or at least I am unaware.

My question is two parts:

1. How would I go about parsing this data so that I can get something out of it (specifically sessionId)?

2. Why is the collection storing it as individual characters? It is coming back as JSON (response header: "content-type"=>["application/json; charset=utf-8"], )

Thanks in advance.


3 replies

Userlevel 7
Badge +17

You are getting very advanced in robotic process automation my friend! The use of the collection variable here doesn't work quite that well because there is nothing in the response that is deliniator-able. 

In the Call to Web Service action - the Response content is the variable to store response content for the web service call. Valid variable types are All except File.

Use the Text type first. Then use the Query JSON action to extracts values from JSON data using a JSONPath expression. This is a link to an example on how to do it. Link to the actual Query JSON action.

Userlevel 6
Badge +12

Andrew Glasser‌ - 

I applied a Regular Expression to target the {sessionId} and was able to get it running past this step. However, I was unaware that the Query JSON action was in there. I was looking for it in the Call Web Service action (similar to the O365 action). I will try that now.

While I did get it working (and now got it working with the Query JSON action...thanks happy.png), I ran into a larger issue... the response was too large to be handled within NWC.

210443_pastedImage_2.png

We ran into throttling issues within SharePoint online around the same step and was looking to remove that piece of it to see if we can still do it using Nintex. We are now looking at making this into an Azure function and running from a VM simply due to load and frequency. Also, looking at optimizing the web calls... there has to be a way to reduce how much is being pulled back in the response!

Userlevel 7
Badge +17

Oh wow, so you have responses in a loop or high frequency, and also the response is large? So you are doing other calls than the ones in the screen shots I assume. The only way to limit the response is if you limit the query or the respondent web service has a way to filter or understands how to do partials. I'm not sure what kind of querying you're doing so can't be sure. 

If you are doing high frequency then Azure Functions and message queuing could help. You probably don't need a VM though. Depending on what data you are connecting to, you could use Logic Apps. But not at the fault of NWC, but to O365 in protection mode. 

Your NWC workflow could send commands to an Azure Queue, allow the Azure Function do its thing, then report back to the NWC or start a new workflow in NWC as a response.

Reply