To connect Salesforce component and Salesforce.com Webservice API to invoke the operation of creating an sObject and querying its Id.
- Start Fiorano Enterprise Server (FES) and Fiorano Peer Server (FPS)
- Login to eStudio application
- Understand the basic menus and perspectives (panels) in eStudio application
- Create a Salesforce account (use URL: https://login.salesforce.com) and note down the username, password and security token that you receive through e-mail.
Create an Account named 'UserAccount1' and query the Id of 'UserAccount1' sObject that gets created.
- SalesForce component.
- Two Feeder components – one feeder to send 'Create Request' and the other to send 'Query Request'.
- Two Display components – one display each for displaying 'Create Response' and 'Query Response'.
Setting up the Example
Downloading Enterprise WSDL
- Log-in to salesforce.com and Click on username on top-right corner of page. Choose Setup in the dropdown.
- In the page opened, under App Setup navigate to Develop > API.
- In the API WSDL page that opens, click Generate Enterprise WSDL. Save the WSDL opened in web browser to a file.
Configuring SalesForce component
To configure SalesForce component, perform the following action in eStudio:
- Add a new Event Process with name 'SalesForce_Example'.
- Drag the SalesForce component present under Bridges category in the Micro Service Palette to the Fiorano Orchestrator.
Figure 1: Adding SalesForce component to Fiorano Orchestrator
- Double-click the SalesForce component in the orchestrator to open Configuration Property Sheet (CPS). Highlighted properties in Figure 2 are used for configuration, which are explained further.
Figure 2: Salesforce Component Property Sheet
- Under Connection section, click the WSDL Configuration button and perform the following actions in WSDL Configuration dialog box, and click OK:
- Retain Load WSDL From value as 'File'.
- Click SalesForce WSDL File Ellipsis button to browse for the downloaded WSDL as explained in the Downloading Enterprise WSDL section.
Figure 3: WSDL Configuration
- Under Call and Addressing section, open Operations window and perform the following actions:
- Click the Add button in the Operations dialog box. Operation with default name 'Operation1' gets added.
- In the Operations dialog box, click Operation button under WSDL Operation Configuration.
- In the Configure dialog box that appears, select the Web Service Operation 'create' and click OK.
Figure 4: Selecting create operation
- Similarly, add another operation and select another operation 'query'.
Figure 5: After adding query Operation
Click Operation1 and replace the name 'Operation1' with 'create' and similarly replace 'Operation2' with 'query' in Port Name Prefix field.
Port name prefix represents the prefix that is appended to names of input and output ports. In case of multiple ports (as in this example), set the same value as that of its operation name to identify the operations distinctly and to eliminate confusion while adding route(s) between port(s).
Modifying Port Name Prefix value to 'query' for query Operation generates query_REQUEST and query_RESPONSE ports. Similarly, make the changes for create operation also.
Figure 6: Modifying Port Name Prefix to 'query' for query operation
Click Login Configurations button. In Login Parameters dialog box, click Add and provide user name and password for Salesforce account as mentioned in Prerequisites section and click OK.
Figure 7: Providing Login Configurations
- Click Finish to save Salesforce configuration. The input and output ports get generated as below:
- Input port for create operation - create_REQUEST
- Input port for query operation - query_REQUEST
- Output port for create operation - create_RESPONSE
- Output port for query operation - query_RESPONSE
Figure 8: Changed names that reflect in tooltip
Composing the Event Process
To work with the SalesForce component, compose the Event Process by performing the below actions:
- Drag two Feeder components and two Display components from Util category in the Micro Service Palette to the SalesForce_Example Fiorano Orchestrator.
- Connect the Feeder component output ports to SalesForce component input ports and connect the SalesForce component output ports to Display components input ports.
- Rename Feeder and Display components logically, based on the input and output ports of the SalesForce component respectively (to identify easily). To rename, click the respective component, press F2, change the name and click OK. Or change the Name property under General tab in Properties, and press ENTER.
In this example, CreateRequest feeder is connected to SalesForce input port for 'create' operation (create_REQUEST) that takes request to create an account. Similarly, QueryRequest connects to input port for 'query' operation (query_REQUEST) that takes query as request. Display components are also connected in similar fashion.
Figure 9: Feeder and Display components connected to SalesForce component
- Double-click createRequest feeder and perform the following actions in Feeder CPS:
In the Message Type Configuration page, retain Output Message Format option as 'XML' and paste a valid XML Schema.Copy this Schema for the present example and paste in the Schema editor
<xsd:element name="Name" type="xsd:string"/>
Figure 10: Feeder with Schema added
- Click the Ellipsis button present in the bottom-right part. In the Root Element dialog box, select 'Account' and click OK. The root element will appear within Select Root Element square brackets present next to the Ellipsis button.
Figure 11: Selecting the root element
- In the Message Details Configuration page, click the Generate Sample button.
- Under 'No.of Repeatable elements to be generated' section in the XSD Sample Generation Dialog window, replace max value '3' with '1' so that only one output is generated, and click OK.
- In the Body tab, under Default Message editor, replace 'Name' with 'UserAccount1'.
Figure 12: After changing name in message body
- Click Finish to save createRequest configuration.
- Right-click route2 (the route that connects CreateRequest and SalesForce), point to Configure Transformation and select Mapper Project to open Fiorano Mapper editor and apply Transformation configuration.
Figure 13: Navigating to Mapper Project for Transformation Configuration
- Expand Mapper Project editor. In Output Structures panel, right-click sObjects element, go to Types and select 'Account'.
Figure 14: Selecting sObject type as Account
- Map the Name element present in Input Structures panel to the Name element in Output Structures panel.
Figure 15: Mapping Name elements in Fiorano Mapper
- Click Save icon (or File > Save) to save the Transformation configuration and close the Mapper Project editor
- Double-click QueryRequest feeder and perform the following actions in Feeder CPS:
- In the Message Type Configuration dialog box, click the Connected Port Schemas button
- Select query_REQUEST in Connected ports dialog box, click OK and click Next.
Figure 16: Connecting port schemas
- In the Message Details Configuration dialog box, click the Generate Sample button.
- Under No.of Repeatable elements to be generated section in the XSD Sample Generation Dialog window, replace max value '3' with '1' so that only one output is generated, and click OK.
- In the Generated Sample, remove SoapHeader element as it is not necessary for query operation and specify the following in queryString:Select Id from Account where Name='UserAccount1'
Figure 17: Select query to get Id(s) of account(s) with Name 'UserAccount1'
Running the Example
To run the SalesForce_Example, perform the following actions:
- Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
- Click Run Event Process icon (ALT+SHIFT+R) to run the event process. Four windows get launched for CreateRequest, CreateResponse, QueryRequest and QueryResponse.
- In the CreateRequest feeder, click the Send button.
Figure 18: Sending message from CreateRequest feeder
- In the CreateResponse display, click the second tab at the bottom of the screen to notice the success message.
Figure 19: Confirmation message for the Account appearing in CreateResponse display
- Similarly, click Send in QueryRequest feeder.
Figure 20: Sending message from QueryRequest feeder
- In the QueryResponse display, click the second tab at the bottom of the screen to notice the success message.
Figure 21: Confirmation message in QueryResponse display
- Download SalesForce_Example event process and import it to the Event Process Repository in the Server Explorer in eStudio to understand the configuration used in this example and to execute the working sample.
- Please note that the options used in this example are minimum, which helps you to get an overview of the application. To explore the other options present in the SalesForce, Feeder and Display, refer sections: SalesForce, Feeder and Display respectively.