Call a Web Service Action

Call a Web Service from a SharePoint Designer 2010 Workflow.

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:
   1: <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"> 
<!--CRLF-->
   2: <soap12:Body> 
<!--CRLF-->
   3: <AddList xmlns="http://schemas.microsoft.com/sharepoint/soap/"> 
<!--CRLF-->
   4: <listName>[%MyList:Title%]</listName> 
<!--CRLF-->
   5: <description>Created by iLSP action</description> 
<!--CRLF-->
   6: <templateID>100</templateID> 
<!--CRLF-->
   7: </AddList> 
<!--CRLF-->
   8: </soap12:Body> 
<!--CRLF-->
   9: </soap12:Envelope>
<!--CRLF-->

For the title of the list we use the title of the current list item that runs the workflow.

Now we extract the ID of the new list.

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

  • Last edited Mar 19, 2011 at 11:03 AM by cglessner, version 3

    Comments

    ninyoade Jan 23, 2013 at 9:18 PM 
    Hi,
    Did Anyone find the solution to deepjust4u issue's below ? I am Having the same Problem... Please advise. Thank you

    manojkumarrai007 Aug 18, 2011 at 10:17 AM 
    Hi,
    Can we call SAP ot Team center webservice from sharepoint designer workflow with this custom action.Please help me.

    deepjust4u May 5, 2011 at 8:26 PM 
    Hi,
    Love this set of activities and have used almost all of them in my projects. There is one issue with this one though, for some reason over HTTPS it always throws 401 exception, works fine in dev and stg which are on HTTP, I am trying to create new items using lists.asmx->Updatelistitems. Please let me know if I am doing something working, I am passing the username and password in clear text not using APPID.