Vadim Tabakman

There are some web services that expose web methods that I can't use via the Call Web Service action in Nintex Workflow. Usually, it's those methods that have "out" parameters, but it can also happen for those methods that use non primitive types as parameters.

Below is an example :
http://<server>/<site>/_vti_bin/Lists.asmx?op=AddAttachment

I honestly don't know the exact reason why there is an issue using that web method, but suffice it to say, YOU CAN'T!

In comes the new Web Request action that Nintex made available in build 11000. It is actually quite handy, and I'm thinking that I will be using this action more often than that Call Web Service in the future.

This is what the configuration of the Web Request action looks like :



In this article, I'm going to take the simplistic approach and just show you how to use this action with SOAP 1.1 packets.

When we look at the SharePoint Lists web service, and specifically the AddAttachment web method, we see it supports a SOAP 1.1, so we select that in our configuration window. The Web Service URL and credentials are the same as if you configuring a Call Web Service action.



You can see that the value of SOAPAction goes into the appropriate edit box in the Web Request configuration, and the SOAP envelope again is a cut'n'paste but all you need to do is fill in the details (place holders).

As a test, I have configured my action to call the AddAttachment web method. What this does, is take the List name, the Item ID where I want to add the attachment to, the name I want to call the new attachment, and the Base 64 encoded value of the data that will go into the file. This would be the best way to add an attachment to a list item if you are building up that data on the fly.

I have set it to pass in my current List, and I want to add an attachment to the item which has a List Item ID of 2. I am building up my filename earlier up in my workflow (which is unimportant in this article). The Base64 encoded data I have in my Nintex Workflow variable is : MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkw

When I run the workflow, my item looks like this :


The reason why I have 3 attachments, is that my workflow actually queries the current item the workflow is running on, getting each attachment in a Base64 encoded form and adds it to the next item.

When I click on the one of the attachment that has the above mentioned Base64 encoded data, it looks like this in it's decoded form:



Output

With what I'm doing in this example, I don't care about the output I am getting back. But if you look at the information provided from the web service, this method does actually return data. If you were to use an web method like "GetAttachmentCollection", then you would get more relevant data back, and you would use the Query XML action to parse that data.

For the "AddAttachment", the output is this :



Querying that with a Query List action would actually be quite straightforward, if you want to get the AddAttachmentResult and store it somewhere for auditting.

Conclusion

There are more things you can do with the Web Request action, such as getting information back, getting it stored in a text variable and then parse it. Or, handle cookies, and keep connections alive. All of which are a little more advanced than this article.

But this should give you some extra options when you are trying to call Web Service methods or HTTP requests.

Posted by Vadim Tabakman Sunday, February 5, 2012 1:26:00 PM Categories: Attachments Base64 Call Web Service Lists.asmx Nintex Nintex Workflow Query List
Copyright Vadim Tabakman
Rate this Content 0 Votes

Comments

Wednesday, January 23, 2013 6:26:37 PM
unknown

re: Nintex Workflow - Web Request action 101

Hi Vadim,

did you have a try about use https address in the url, i have a requirement to send a request to a https site, but i'm not successful.

Sunday, January 27, 2013 1:45:23 PM

re: Nintex Workflow - Web Request action 101

Hi,

I haven't tried using an HTTPS url.  I currently don't have an SSL enabled SharePoint site to test it out on.

cheers,

Vadim

Wednesday, February 20, 2013 4:30:59 AM
Vijay M B

re: Nintex Workflow - Web Request action 101

Hi Vadim,

 

It worked for me, thanks for posting the informatin.

Best Regars,

Vijay.M.B

 

Wednesday, February 20, 2013 7:08:35 AM

re: Nintex Workflow - Web Request action 101

Hi Vijay,

I'm glad this helped :).

cheers,

Vadim

Sunday, September 22, 2013 6:24:13 AM
Kaustubh

webservice to pass data to request data action

Hi Vadim,

I want to pass data using Infopath form to Request data action of Nintex workflow. I can see the processtaskresponse webservice to pass continue as a parameter to the request data action to move ahead but not able to understand how to pass data required by request data action. I have a due date change which needs to be selected by User and then needs to pass on for approval. I was trying that i should have a way to pass the data using infopath form. Please let me know how to achieve.

 

Thanks,

KP

 

Wednesday, February 17, 2016 9:49:48 AM
Tanuj Gupta
Gravatar

re: Nintex Workflow - Web Request action 101

Hi Vadim,

Thanks for your wonderful post. I have learned a lot in "Nintex Workflow" from you.

I also have a requirement to copy attachment from one list to another list.

I am successfully able to copy the document but the content of the document is encrypted in base64Binary. I have used "CopyIntoItems" web service.

Can I please know what I am doing wrong.

Waiting for your keen reply.

Many thanks for your wonderful post and knowledge.

Wednesday, February 17, 2016 2:32:23 PM

re: Nintex Workflow - Web Request action 101

Hi Tanuj,

are you copying a document from a doclib or a document that is an attachment?

I believe you may need a two step process here.

Workflow 1 (runs on the original item) - Copy to SharePoint action to copy the attachments to a temp Document Library.

Workflow 2 (runs on the document library) - uses a Call Web Service action to call Lists.asmx > AddAttachment to add the current document, as an attachment to an item in another list.

Vadim

Tuesday, June 7, 2016 7:55:40 AM
Nick Magill
Gravatar

re: Nintex Workflow - Web Request action 101

Hi Vadim,

We used this today to run the "GetVersionCollection" web service.

SharePoint is nice enough to return invalid xml - looks like when the field name has spaces in it.

<Version Field Name With Spaces="lorum ipsum" ...... />

A bit of string manipulation later and it's working.

Cheers,

Nick

Tuesday, June 7, 2016 8:19:55 AM

re: Nintex Workflow - Web Request action 101

ahh interesting.  I have never tried it on fields with spaces.  Thanks for letting me know.

cheers,

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