Vadim Tabakman

Web Services are quite handy, but some of the data that gets returned can look like giberrish. This is especially true when you are dealing with XML that gets returned.

A scenario I came across recently, was getting a list of SharePoint users that are in a SharePoint group. This is possible via the SharePoint UserGroup web service - http://msdn.microsoft.com/en-us/library/ms772647.aspx. Specifically, the GetUserCollectionFromGroup web method.

In order to use the information from this web method, we need to parse the XML returned, and extract the information we need.

What I have found to be the easiest way to start working on this type of issue, is to configure the Call Web Service action to make this call and store the result in a text variable.



Now that we have the resulting XML in a text variable, we want to see what it looks like. You can't log it to the workflow history, because there are just too many characters in it.

Instead, I use a Send a Notification action and configure it to send the initiator of the workflow an email with the XML as a file attachment.



To add an attachment to a Send a Notification action, you simple click on the "Show Attachments" link. Then click on the "Add Attachment" link and it will give you a pop up that will allow you add an attachment to your notification.



You then click on the "New File" radio button, type in a filename you want for your attachment. I usually use something like "xml.txt", as it lets me easilly open the file in notepad.



Click on the Insert Reference button, and you can insert your text variable which contains your XML into the attachment.



Now we can publish the workflow, run it and you should get an email with the attachment. You can then open it, and figure out the best way to use the Query XML action to parse the data that you need.

This is what the email looks like :



As you can see, the attachment is 605 bytes. A lot bigger than what is allowed in a Workflow History message (255 bytes).

As I'm attaching this as a text file, if you open it up, it's not going to be very pretty. But if you save it to your local disk and rename it to XML and open it in something like Internet Explorer, it will look something like this :



Now it's easy to see that we are getting the data we expect, and also what format that data is in, so we know whether to use XSL or XPath in our Query XML action.

What this complicated workflow looks like :



Note : Workflow has been updated to include a few Query List actions to retrieve the Login Name, Email and Name from each User node that we have received from the Web Service call.

Note : this doesn't have to be specific to XML or even responses from Web Services. It can be used in any situation you have some data you want to see in a complete form, but it is not possible via the workflow history.

Useful Downloads

Get Users in a Group Workflow download

Posted by Vadim Tabakman Sunday, February 5, 2012 2:37:00 PM Categories: Call Web Service Nintex Nintex Workflow Query XML Run Parallel Actions
Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Saturday, November 29, 2014 12:11:50 AM

That insight's perfe

That insight's perfect for what I need. Thanks!
Thursday, April 21, 2016 3:57:59 AM
Dhinesh Kumar J
Gravatar

re: Nintex Workflow - Web Service XML Result - What does it look like ?

Hi Vadim,

i am getting empty response sometime(it's quite intermittent), i just wanted to dynamically collect the users from the group & assign it into the Collection variable. Not sure why it's empty response, can you give me any details where should i check & verify. when there is empty response not called the web service --> the reason i said this no entry can be found in the ULS log file. whenever getting success response it's available in the ULS Log.

 

Thanks & Regards,

Dhinesh Kumar J.

 

Thursday, April 21, 2016 8:57:59 AM

re: Nintex Workflow - Web Service XML Result - What does it look like ?

Hi Dhinesh,

I'm afraid I don't know why you'd be getting an empty response from the UserGroups.asmx web service.

I'd suggest you put some logic into your workflow that checks that if no response is received, that it try again.

But I'd also recommend that you put a limit on the number of times you retry.  If you constantly get empty responses, the workflow shouldn't just keep retrying... as obviously soemthing is wrong.

 

Vadim

Friday, April 22, 2016 5:31:51 AM
Dhinesh Kumar J
Gravatar

re: Nintex Workflow - Web Service XML Result - What does it look like ?

Hi Vadim,

we have two web front end servers for our SharePoint environment in the Production. I am getting some error in the static time itself  while test connection in the call web service action using the user name & password saved in the central admin, it throws some time user not found & sometime proxy error , Unauthorized kind of things. I damn sure i have used the system account in the central admin mange workflow constants. 

Is that possible to get more logs why it's throws these errors? I am facing issues while connecting the Nintex workflow web service via C# code as well. (i have a custom page for Nintex Felxi task Approval hence i used two methods in the workflow web service --Get running workflows history for the current item & get task item from the running workflows) All of us gives sometime working & sometime not working.

Can you give any advice on this?

Thanks & Regards,

Dhinesh Kumar J.

 

Friday, April 22, 2016 6:50:29 AM

re: Nintex Workflow - Web Service XML Result - What does it look like ?

Hi Dhinesh,

other than the SP logs, I don't know of anything to look at.

Maybe reach out to support@nintex.com

Vadim

You must sign in to this site to post comments.
Already Registered?
Sign In
Not Yet Registered?
Register

Statistics

  • Entries (279)
  • Comments (1769)

Categories