<dependency>
<groupId>org.mule.modules</groupId>
<artifactId>mule-module-concur</artifactId>
<version>RELEASE</version>
<classifier>mule-plugin</classifier>
</dependency>
SAP Concur Connector - Mule 4
Support Category: Select
SAP Concur Connector v4.0
Anypoint Connector for SAP Concur (Concur Connector) is a SaaS provider from SAP for integrated travel and expense management solutions.
Concur Connector operates as a bidirectional gateway between instances of Concur and Mule runtime engine (Mule). Concur Connector is a closed-source connector that supports SOAP and REST calls to Concur APIs.
Release Notes: SAP Concur Connector Release Notes
Exchange: SAP Concur Connector
Prerequisites
To use this information, you should be familiar with SAP Concur, Mule, Anypoint Connectors, Anypoint Studio, Mule concepts, elements in a Mule flow, and Global Elements.
You need login credentials to test your connection to your target resource.
For software requirements and compatibility information, see the Connector Release Notes.
POM File Information
Mule converts RELEASE to the latest version. To specify a version, view Anypoint Exchange and click Dependency Snippets.
Connect in Design Center
-
Click a trigger. You can create a global element by selecting Reusable Configurations. If a global element is not needed, you can use an HTTP Listener or Scheduler trigger.
-
To create an HTTP global element for the connector, set these fields:
Field Description Protocol
Protocol selected for the HTTP endpoint, it can be HTTP or HTTPS (secure).
Host
IP address where your Mule application listens for requests.
Port
Port address where your Mule application listens for requests.
Base
Path where your Mule application listens for requests.
-
Select the plus sign to add a component.
-
Select the connector as a component.
-
Select an operation (see the next section for a list of operations).
-
Configure the Global element for the connector.
Field Description Host
Enter the host name of the Concur connector.
Port
Enter the port on which the Concur connector is running. Default value is 443.
Base Path
Path where your Mule application listens for requests.
Protocol
Protocol selected for the http endpoint, it can be http or https (secure).
Authorization
A Concur access token.
-
Create an access token for your Concur instance by specifying
https://www.concursolutions.com:443/net2/oauth2/accesstoken.ashx
in Postman with the GET method. -
Configure Basic Auth with your username and password.
-
Configure the X-ConsumerKey with your Consumer Key in the Concur headers.
The following returns from Concur:
<Access_Token> <Instance_Url>https://www.concursolutions.com/</Instance_Url> <Token>0_PijEv7CuZl+123123123=</Token> <Expiration_date>2/28/2019 11:34:51 PM</Expiration_date> <Refresh_Token>0_HlvMXvXod6LsK123123123123123=</Refresh_Token> </Access_Token>
-
Put the token in the SAP Concur connector configuration, for example:
Oauth 0_PijEv7CuZl+123123123=
Add the Connector to a Studio Project
Anypoint Studio provides two ways to add the connector to your Studio project: from the Exchange button in the Studio taskbar or from the Mule Palette view.
Add the Connector Using Exchange
-
In Studio, create a Mule project.
-
Click the Exchange icon (X) in the upper-left of the Studio task bar.
-
In Exchange, click Login and supply your Anypoint Platform username and password.
-
In Exchange, search for "concur".
-
Select the connector and click Add to project.
-
Follow the prompts to install the connector.
Example Use Case
This guide presents two of many use cases you might have for the Concur connector in your organization: getting a list of lists and retrieving quickexpenses. You may jump ahead and paste the code for the flows into the XML Editor in Studio after you download the Concur connector and create a global element to reference your Concur instance credentials.
Retrieve a List of Lists
After creating a new project and a Concur global element:
-
Add a new flow element by dragging it from the palette and give a name to the flow, such as
getlists
. -
Drag an HTTP Listener into your flow from the palette.
-
Double-click the HTTP Listener and click the green plus sign next to the Connector Configuration dropdown and set the Host to localhost, and the Port to 8081.
-
Click OK to close the properties window, then enter getlists as the value in the Path field in this HTTP listener’s Basic Settings section.
-
Add a Concur connector to the new flow and select the Get list of lists operation, after selecting the Connector Configuration you desire.
-
Finally, add a Transform Message transformer to the flow.
-
For reference you may check the particular getlists flow within the example XML code further down.
To execute the flow and check the outcome:
-
Right-click the project in the Package Explorer, and click Run As > Mule Application.
-
Check that the application has started by monitoring the Studio console.
-
Open browser and go to
http://localhost:8081/getlist
-
You should receive a JSON response like this:
{"list":[{"batchLink":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GsRt9CeqUjOAfZXRTmGyyVczqg/batch","id":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GsRt9CeqUjOAfZXRTmGyyVczqg","isVendor":false,"itemsLink":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GsRt9CeqUjOAfZXRTmGyyVczqg/items","levels":1,"name":"AT Tax Form List 1"}, {"batchLink":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GsRsUIXmIbg3iUc6qE9AlKEVxA/batch","id":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GsRsUIXmIbg3iUc6qE9AlKEVxA","isVendor":false,"itemsLink":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GsRsUIXmIbg3iUc6qE9AlKEVxA/items","levels":1,"name":"BE Tax Form List 1"}, {"batchLink":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GscWDPncbQqGUoCjCv4pxrnp2A/batch","id":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GscWDPncbQqGUoCjCv4pxrnp2A","isVendor":false,"itemsLink":"https://www.concursolutions.com/api/expense/list/v1.0/gWqXO46r6GscWDPncbQqGUoCjCv4pxrnp2A/items","levels":1,"name":"CH Tax Form List 1"}
-
Click the stop button to halt the server running the application.
Create a Quick Expense
-
Add a new flow element by dragging it from the palette and name it getquickexpenses.
-
Add an HTTP Listener to your flow by dragging it from the palette.
-
Use the configuration from the first demo, or if you did not create that flow, click the green plus sign next to Connector Configuration for the HTTP endpoint and enter localhost as the Host and 8081 for the Port.
-
Click OK to close the properties window, then enter getquickexpenses as the value in the Path field in this HTTP listener’s Basic Settings section.
-
Add the Concur connector to the new flow, referencing a global element from the Connector Configuration and set an Operation to perform and any other properties you require.
-
Finally, add an Transform Message transformer link in the previous example.
To execute the flow and check the outcome, perform the following steps:
-
Right-click the project in the Package Explorer > Run As > Mule Application
-
Check the console to see when the application starts.
-
Open the browser and go to
http://localhost:8081/getquickexpenses
-
You should receive a JSON response like this:
{"items":{"quickExpense":[{"comment":"","currencyCode":"USD","expenseTypeCode":"UNDEF","expenseTypeName":"Undefined","id":"gWr7TiTHdIi5fyWCPBRPtqjeCIWyv2w","locationName":"","ownerLoginID":"","ownerName":"Unknown","paymentTypeCode":"PENDC","receiptImageID":"","transactionAmount":111.0,"transactionDate":"2018-07-21T00:00:00","uri":"https://www.concursolutions.com/api/v3.0/expense/quickexpenses/gWr7TiTHdIi5fyWCPBRPtqjeCIWyv2w","vendorDescription":""}, {"comment":"","currencyCode":"USD","expenseTypeCode":"UNDEF","expenseTypeName":"Undefined","id":"gWr7TiTXbQ47PtJ$pVkr6CzbLeRVRPww","locationName":"","ownerLoginID":"","ownerName":"Unknown","paymentTypeCode":"PENDC","receiptImageID":"","transactionAmount":111.0,"transactionDate":"2018-07-21T00:00:00","uri":"https://www.concursolutions.com/api/v3.0/expense/quickexpenses/gWr7TiTXbQ47PtJ$pVkr6CzbLeRVRPww","vendorDescription":""},
-
Click the stop button to halt the server running the application.