Home Search

DriveWorks Pro 22
How To: Create the Data for a Web Service to Communicate with DriveWorks Autopilot (KB18090401)

Send Feedback

How To: Create the Data for a Web Service to Communicate with DriveWorks Autopilot

About Web Services

A web service is a method of communicating over the Internet.

It uses a standardized messaging system that allows data to be pushed and pulled from service to service.

DriveWorks utilizes either XML or JSON to communicate with other Web Services.

Most web based vendors such as Google, Amazon, Twitter and Salesforce provide some level of Web Services.

Web Services can be categorized into 3 levels:

  • Open - Freely available, no account required. Google Maps provide a distance matrix that is an open Web Service for example.
  • Authentication - A valid account is required to use this level of Web Service. For example Twitter allows data to be pushed to a valid account.
  • Subscription - A valid account with an active subscription is required to communicate with this level of Web Service. An example would be to communicate with a companys Salesforce data.

Using DriveWorks to Communicate with the DriveWorks Web Service Connector

A DriveWorks Project can be set up that communicates with the DriveWorks Web Service Connector.

This Project should use the Specification Flow Task - Send HTTP Request.

This task sends a request over the web to the listen URI, so although in this case it is our own Autopilot, it could be any open web service URI.

To apply the correct information to the properties of the Send HTTP Request Task the following information is required:

  • Request Body
  • Request Headers

Request Body

The Request Body contains all of the information that the Web Service needs in order to create a new Specification.

This includes the information to:

  • Drive the name of the Project to run (MyProject)
  • Drive the name of the Transition to invoke (Release)
  • Drive the controls to differing values ([ControlName] and [ControlValue])
Request Body Example XML (SOAP)
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
	<CreateSpecification>
		<projectName>MyProject</projectName>
		<transitionName>Release</transitionName>
		<values>
			<KeyValueOfstringstring xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
				<Key>[ControlName]</Key>
				<Value>[ControlValue]</Value>
			</KeyValueOfstringstring>
			<KeyValueOfstringstring xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
				<Key>[ControlName]</Key>
				<Value>[ControlValue]</Value>
			</KeyValueOfstringstring>
		</values>
	</CreateSpecification>
</soap:Body>
</soap:Envelope>

When the Request Body is built in the Rule Builder it will look like the image below:

Note the quotes (") at the beginning and end of the XML and each single quote required in the XML has been replaced with a double quote ("").

Also replace the values given for projectName and transitionName with the required values from your Project.

And replace each instance of [ControlName] and [ControlValue] with the controls from your project and their required values.

The Request Body can also specify an existing Specification you want the connector to run on.

To do this:

Under the <CreateSpecification> Element, create a new Element called <SpecificationID> or <SpecificationName> and pass the corresponding value of the Specification you want run the connector on.

For example:

<SpecificationName>MySpecification 0019</SpecificationName>
            

Request Header

The Request Header instructs the Web Service how to treat the data.

The content is specified as text/xml, the character set to process is utf-8, and it should also contain the instruction to Create a Specification.

Request Headers Example XML
content-type:text/xml; charset=utf-8|SOAPAction: "urn:IHttpConnectorService/CreateSpecification"
            

When the Request Header is built in the Rule Builder it will look like the image below:

Note the quotes (") at the beginning and end of the XML and each single quote required in the XML has been replaced with a double quote ("").

Constants

Constants in the Project can be used to store the Response Body and Header.

The response will allow the success of the request to be determined.

Add the Send HTTP Request Task

The task can be added to a Specification Macro or the Specification Flow within a Project.

See Send HTTP Request for more information.

Enter the values applied in the Project to the properties of the Task.

The Request URL may not be known until the connector has been set up in DriveWorks Autopilot. See the Create the Connector section below for more information on this.

Once the Task has been applied it should look like one of the images below:

Specification Macro
Specification Flow

If the task is to be run as a Specification Macro you will need to create a Macro Button on a user form in the Project.

If the task is to be run as part of the Specification Flow the task should be added to an appropriate Event or Transition on an existing State.

Create the Connector

To set DriveWorks up as a Web Service a new Web Service Connector must be added to DriveWorks Autopilot.

Please refer to the topic Connectors for information to Add a New Connector.

Once the Web Service connector has been added please refer to the topic Connectors - Web Service for information on the settings to apply.

Using the Web Connector to Edit an Existing Specification

Request Header Example XML
"content-type:text/xml; charset=utf-8|SOAPAction: """&"urn:IHttpConnectorService/EditSpecification"""
            


Request Body Example XML
"<?xml version=""1.0"" encoding=""utf-8""?>
<soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/""
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
<soap:Body>
<EditSpecification>
<projectName>WebConnectorProject</projectName>
<transitionName>Another</transitionName>
<specificationName>WebConnectorProject 0038</specificationName>
<specificationId>0038</specificationId>
<operationName></operationName>
<values>
</values>
</EditSpecification>
</soap:Body>
</soap:Envelope>"
            
The example above will invoke the transition "Confirm Order" to specification "0006" of the project "Connectors". To edit an existing specification, all of the tags provided above must be included. Even if some of the values are empty. They must also be kept in the order provided
Knowledge Base Article Ref:KB18090401