Mar 19, 2011

Call a Web Service Action (Advanced SharePoint Designer 2010 Workflow Actions)

With this custom SharePoint Designer Action you are able to call web services from SPD workflows. The action is included in my Advanced SharePoint Designer 2010 Workflow Actions release on CodePlex. The source code is available too. Let’s go!

1. Add “Call a Web Service” Action to a SharePoint Designer 2010 Workflow

image

2. Configure the Action

image
  • URL: The URL of the Web Service
  • SOAP Version: The SOAP Version of the request (1.1. or 1.2)
  • Action: The SOAP Action for the request
  • SOAP Request Envelope: The SOAP Envelope for the request (http://schemas.xmlsoap.org/soap/envelope/). The request will be UTF8 encoded. You can use two special tokens in the request that can not be inserted via the UI: [WebUrl] and [WorkflowInstanceId].
  • User: The user name for requests that needs authentication e.g. “Contoso\Administrator”. Instead of using user name and password you can use Secure Store Credentials.
  • Password: The password for the user. Unfortunately there isn’t a masked text box :-( You could either specify the password  in clear text or encrypted like described here: Encrypt Passwords for SharePoint Designer Workflow Actions
  • AppId: The The Secure Store Application ID. The Secure Store App have to define 2 Fields. One of type “User Name” and one of type “Password”. The Field Name doesn’t matter, important is the Field Type! You have to map the credentials of the SharePoint Service Accounts (AppPool/owstimer.exe). The secure store option will only works with SharePoint Server not with Foundation!

3. Example

Create a new List with the SharePoint Lists.asmx Web Service.
image

Configuration of “Call Web Service”

  • URL: http://[siteurl]/_vti_bin/Lists.asmx
  • SOAP Version: SOAP 1.2
  • SOAPAction: not needed for SOAP 1.2
  • Response: The response will be stored in the variable “Response”
  • User: empty
  • Password: empty
  • Secure Store AppId: Instead of using user name and password we use the secure store app with the ID test. The app defines “User Name” and Password. The format of the user name for windows user should be “Domain\username”.
  • SOAP Request Envelope:
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<AddList xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>[%MyList:Title%]</listName>
<description>Created by iLSP action</description>
<templateID>100</templateID>
</AddList>
</soap12:Body>
</soap12:Envelope>
For the title of the list we use the title of the current list item that runs the workflow. To figure out how the request should looks like you could inspect request with fiddler. I often create a WCF service proxy with Visual Studio, execute the call and inspect the request and result XML with fiddler.

Next we extract the ID of the new list.from the resulting XML. To do this you can use the “Query XML” action that is also included in the package.

Configuration of “Query XML”

  • XML: The XML of the SOAP-Reponse that has been stored in the Variabe “Response”
  • XPath: //*[local-name()='List']/@ID
  • Output: The output (List Id) will be stored in the Variable “ListID”

Write the “ListID” to the history log

image
download | documentation

27 comments:

arka said...

Hi

sometimes (I guess when web service isn't available) workflow enters into "Error occured" state.

"Error System Account
Error in HTTP-Request: Unable to connect to the remote server "

termination of workflow is quite complicated.

Is it possible to avoid "Error occured" state and get simmilar response to "Output"?

Christian said...

Unfortunately not in current implementation. In general it is possible,I did that for create site.

Anonymous said...

[%MyList:Title%]

In the code above part doesn't work for me. Do you have any ideas for that?

Thanks

Barclay Fleming said...

I was looking for an information where I can call a web service action. This would be a good guidance to follow to know and understand everything in much detailed way.

Web Design Company said...

Very Important information!I would like to say that this blog is very informative and i would love to visit it again.

Seo web solutions said...

I am always searching online for articles that can help me. Looking forward to another great blog. Good luck to the author! all the best.

digital signature software said...

Grateful to check out your website, I seem to be ahead to more excellent sites and I wish that you wrote more informative post for us. Well done work.

Chanel Replica Handbags said...

The best thing about this bag is its carrying versatility. Unlike other bucket bags, the Ricky has a detachable shorter strap which makes it easier for the bag to be carried on the hand or on the crook of one’s arm.

Hug Day said...

happy hug day Images
hug day 2016 Wishes cards greetings
Hug day Gift Ideas For Him/Her
hug day sms for bf

Happy Mothers day Wishes said...

happy mothers day 2016 sayings and

mothers day poems 2016
and
mothers day messages 2016 and

mothers day quotes 2016 and

happy mothers day greetings 2016 and

happy mothers day wishes 2016

风骚达哥 said...

20160423 junda
air jordans
cheap oakley sunglasses
kate spade outlet
adidas stan smith
ray ban sunglasses
michael kors outlet
nike air max shoes
cheap omega watches
yeezy boost 350
michael kors outlet online
michael kors outlet online
nike free runs
air jordan uk
michael kors outlet online
pandora charms
ray ban outlet
calvin klein outlet
fitflops sale clearance
toms outlet
nike huarache white
sac longchamp
toms outlet
michael kors outlet clearance
bottega veneta outlet
armani watches
gucci handbags
nike blazer
oakley sunglasses
true religion jeans
cheap jordans
ray bans
hollister
bottega veneta handbags
jimmy choo outlet
oakley sunglasses
converse
prada outlet
reebok shoes
true religion
burberry outlet

Sagir Kazi said...

Its giving me the below error when I am calling the webservice from the workflow and the workflow errors out. I am able to browse the webservice from my machine and from sharepoint server successfully.

Error in HTTP-Request: The remote server returned an error: (503) Server Unavailable.

Sagir Kazi said...

Just to add to it, below is what is logged in my ULS logs.

System.Net.WebException: The remote server returned an error: (503) Server Unavailable. at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) at System.Net.WebClient.UploadString(Uri address, String method, String data) at ILoveSharePoint.Workflow.Activities.WebServiceActivity.<>c__DisplayClass1.b__0() at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at ILoveSharePoint.Workflow.Activities.WebServiceActivity.Execute(ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(T activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutor`1.Execute(Activity activity, ActivityExecutionContext executionContext) at System.Workflow.ComponentModel.ActivityExecutorOperation.Run(IWorkflowCoreRuntime workflowCoreRuntime) at System.Workflow.Runtime.Scheduler.Run()

Fangyaya said...

michael kors handbags
coach factory outlet online
ghd flat iron
louis vuitton handbags
ralph lauren
polo shirts
ray ban sonnenbrille
nfl jerseys wholesale
kate spade outlet
ray ban sunglasses
coach outlet online
coach outlet online
louis vuitton outlet stores
christian louboutin sale
giuseppe zanotti sneakers
cheap ray ban sunglasses
michael kors outlet clearance
louboutin shoes
air jordan shoes
tods sale
replica rolex watches
coach outlet
coach outlet store online
louis vuitton outlet stores
coach outlet store online clearances
adidas yeezy
tory burch flats
polo ralph lauren
coach outlet store online clearances
air jordan 11
20168.8chenjinyan

dada24 Xu said...

canada goose jackets
birkenstocks
ugg outlet
cheap uggs
canada gooses outlet
louis vuitton
rolex replica watches
fitflops sale clearance
gucci outlet
cheap jordans
2016921caiyan

Paulo said...

There were a great deal shady and ruthless loaning hones that banks may have used to get you into a home loan that has made it exceptionally troublesome for you to pay it back. At the point when things aren't feasible for you, the bank loses thus do you. That implies you both have a common enthusiasm for adjusting the bank credit to something that improves you both off. aaa1autotitleloans.com/chicago

Robbert said...

DIY not just gives their magnificent auto enlist benefits in the wonderful city of Adelaide, yet in whole Australia, coverig all real urban areas and traveler goals like Melbourne, Brisbane, Perth, and so forth. Every one of the autos gave are absolutely tried and true and completely checked for any conceivable motor blame or disappointment. usacheckcashingstore.com/corona

Robbert said...

Always scour the Internet for Fort Lauderdale auto rental locales, which takes into account better correlation shopping purposes. Likewise, recall that littler is not really less expensive since regardless you need to calculate gas costs in connection to the measure of auto driving you will do. usacheckcashingstore.com/chula-vista

Robbert said...

When you have distinguished the auto, precisely take a gander at the cost. There is a FOB cost when purchasing an auto on the web and a CIF to your closest port cost. The CIF cost is the best since it is comprehensive of transportation to your nation. While numerous auto vender sites don't indicate CIF yet oblige you to compute cargo, it is imperative to comprehend what is the CIF cost of the utilized auto. check cashing

chenmeinv0 said...

toms outlet
cheap nhl jerseys
polo shirts
kate spade
christian louboutin heels
gucci outlet
christian louboutin outlet
gucci belts
new york knicks jerseys
oakley sunglasses
hzx20170228

Unknown said...

cheap replica watches
air max 90
iphone case uk
michael kors handbags
ralph lauren outlet
michael kors canada
nike air max 90
coach outlet
michael kors outlet clearance
michael kors outlet
chanyuan2017.05.08

dong dong23 said...

new balance 990
cheap mlb jerseys
pandora charms outlet
adidas ultra boost uncaged
nike shoes
adidas outlet
true religion jeans outlet
coach outlet store online clearances
christian louboutin sale
ferragamo outlet
2017.5.11chenlixiang

xjd7410@gmail.com said...

coach handbags outlet
ralph lauren outlet
kate spade uk
true religion jeans
mac cosmetics sale
ray-ban sunglasses
coach outlet online
ralph lauren
true religion jeans
new balance outlet
chanyuan2017.05.24

شركة المثالية لتنظيف said...

شركة تنظيف منازل بالجبيل

raybanoutlet001 said...

oakley sunglasses
pandora outlet
jordan shoes
ecco outlet
coach outlet
ugg boots
gucci shoes
coach outlet online
christian louboutin shoes
ugg boots

Best Construction Company City of Yonkers said...

The team at Ajrin Construction Inc. is the best of the best general contractors and support staffs, as selected from within the industries over City of Yonkers NY based upon their achievements and their understanding of complex projects.
Best Construction Company City of Yonkers

قمة الخليج said...

شركة عزل اسطح
خدمات عزل الاسطح من الخدمات التى فى حاجة الية فى المكان فاذا اراد ان تقوم باعمال العزل لاى اسطح فى المصانع – المنازل – الفلل ... وغيرها وتبحث عن افضل الخدمات التى تساعد فى الوصول الى افضل ما تتمنى ان ترى علية النتائج فعليك ان تتعاون مع شركة قمم التميز شركة عزل اسطح بالمدينة المنورة
التى تحقق اعلى مستوى من العزل بالاعتماد على افضل المواد المخصصة فى القيام باعمال العزل والتى استطاعت ان تتاكد ان اعمال العزل التى تتم بالخيش المقطرن والسيلتون من افضل الخدمات المثالية المميزة التى تحقق اعلى مستوى من العزل دون ان يؤدى الى ظهور اى عيب فى اعمال العزل . شركة تسليك مجاري بالمدينة المنورة
لا تكتفى شركة قمم التميز بالقيام باعمال العزل فى منطقة معينة بل تسعى الى الوصول الى اى مكان فى شرق الرياض – جنوب الرياض – غرب الرياض – وسط الرياض من اجل ان تحقق خدمات العزل لجميع عملاء الشركة الكرام . شركة عزل خزانات بالمدينة المنورة
تهتم شركة عزل اسطح بالقيام باعمال العزل الحرارى من خلال الاعتماد على افضل الطرق المثالية وافضل الخدمات المميزة فى القيام باعمال العزل بالاضافة الى ان الشركة تهتم باعمال الكشف الدورى من فترة الى اخرى من اجل ان يتم التحقق ان اعمال العزل تمت كما هو مطلوب فى المكان . شركة تنظيف خزانات بالمدينة المنورة
ايضا من اهم الطرق الحديثة التى استخدامت فى العديد من الدول الاوربية لانه يساعد فى حماية المبنى من التعرض الى الحرارة المرتفعه او التعرض الى التسربات للمياة والحفاظ على المبنى من اى مشاكل وعوامل مناخية ، فاعمال العزل للفوم اختصار لكل طرق العزل والتى تساعد فى الحفاظ على المبنى .
كشف تسربات المياه
كشف تسربات المياه بالمدينة المنورة
تسربات المياه مشكلة تؤدى الى التعرض الى عدد من المشكلات الاخرى ، فالاهمال فى تسربات المياه يؤدى الى التعرض الى الكثير من المشكلات التى نحن فى غنى عنة فاذا تعرض الى التسربات وتعرضت الى ظهور عدد من المشكلات الاخرى مثل سقوط الدهانات والتعرض الى مشاكل الرطوبة فعليك ان تتواصل وتتعاقد مع شركة قمم التميز المخصصه فى اعمال الكشف عن تسربات المياه والتى تحقق افضل ما تتمنى ان ترى علية المكان من خلال القيام بالاتى :- شركة جلي بلاط رخام بالمدينة المنورة
1- الاهتمام باحدث الاجهزة المخصصة فى اعمال الكشف وبالاضافة الى التعرف على اساليب الكشف التى تتلائم مع مكان التسرب .
2- الاعتماد على العمالة المدربة الكاملة التى تحقق افضل مستوى من النتائج من خدمات التنظيف والكشف والاصلاح والتى تحقق افضل ما تتمنى ان ترى علية المكان .
3- الاهتمام بخدمات التنظيف بعد ان تتم اعمال الاصلاح .
شركة عزل فوم بالمدينة المنورة