Contents

Objective

To connect Salesforce component and Salesforce.com Webservice API to invoke the operation of creating an sObject and querying its Id.

Icon

'sObject' refers to any object that can be stored in the Salesforce.com platform database like Account, Lead, Contact etc.

Prerequisites

  • 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.

Scenario

Create an Account named 'UserAccount1' and query the Id of 'UserAccount1' sObject that gets created.

Components Used

  • 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

  1. Log-in to salesforce.com and Click on username on top-right corner of page. Choose Setup in the dropdown.
  2. In the page opened, under App Setup navigate to Develop > API.
  3. 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:

  1. Add a new Event Process with name 'SalesForce_Example'.
  2. 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
     
  3. 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
     
  4. Under Connection section, click the WSDL Configuration button and perform the following actions in WSDL Configuration dialog box, and click OK:
    1. Retain Load WSDL From value as 'File'.
    2. Click SalesForce WSDL File Ellipsis button to browse for the downloaded WSDL as explained in the Downloading Enterprise WSDL section.


      Figure 3: WSDL Configuration
       
  5. Under Call and Addressing section, open Operations window and perform the following actions:
    1. Click the Add button in the Operations dialog box. Operation with default name 'Operation1' gets added.
    2. In the Operations dialog box, click Operation button under WSDL Operation Configuration.
    3. In the Configure dialog box that appears, select the Web Service Operation 'create' and click OK.


      Figure 4: Selecting create operation
       
  6. Similarly, add another operation and select another operation 'query'.


    Figure 5: After adding query Operation
     
  7. 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.

    Icon

    Refer Figure 8 to see that input port and output port are generated with the modified names. Similarly, create Operation appears with name 'create_REQUEST'.



    Figure 6: Modifying Port Name Prefix to 'query' for query operation

  8. 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.

    Icon

    While adding password, security token must be concatenated. For example, if password is "password123" and security token is "abcdefgHijklMnopQrstuVwxY", then password entered must be "password123abcdefgHijklMnopQrstuVwxY".


    Figure 7: Providing Login Configurations
     

  9. Click Finish to save Salesforce configuration. The input and output ports get generated as below:
    1. Input port for create operation - create_REQUEST
    2. Input port for query operation - query_REQUEST
    3. Output port for create operation - create_RESPONSE
    4. 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:

  1. Drag two Feeder components and two Display components from Util category in the Micro Service Palette to the SalesForce_Example Fiorano Orchestrator.
    1. Connect the Feeder component output ports to SalesForce component input ports and connect the SalesForce component output ports to Display components input ports.
    2. 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
       
  2. Double-click createRequest feeder and perform the following actions in Feeder CPS:
    1. 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:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"

          targetNamespace="http://www.salesforce.com"

          elementFormDefault="qualified">

          <xsd:element name="Account">

              <xsd:complexType>

                  <xsd:sequence>

                          <xsd:element name="Name" type="xsd:string"/>

                  </xsd:sequence>

              </xsd:complexType>

          </xsd:element>

      </xsd:schema>


      Figure 10: Feeder with Schema added

    2. 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
       
    3. In the Message Details Configuration page, click the Generate Sample button.
    4. 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.
    5. In the Body tab, under Default Message editor, replace 'Name' with 'UserAccount1'.


      Figure 12: After changing name in message body
       
    6. Click Finish to save createRequest configuration.
       
  3. 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
     
  4. 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
     
  5. 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
     
  6. Click Save icon (or File > Save) to save the Transformation configuration and close the Mapper Project editor
  7. Double-click QueryRequest feeder and perform the following actions in Feeder CPS:
    1. In the Message Type Configuration dialog box, click the Connected Port Schemas button
    2. Select query_REQUEST in Connected ports dialog box, click OK and click Next.


      Figure 16: Connecting port schemas
       
    3. In the Message Details Configuration dialog box, click the Generate Sample button.
    4. 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.
    5. 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:

  1. Click Check Resource and Connectivity icon (or press ALT+SHIFT+C) to check resource and connectivity.
  2. Click Run Event Process icon (ALT+SHIFT+R) to run the event process. Four windows get launched for CreateRequest, CreateResponse, QueryRequest and QueryResponse.
  3. In the CreateRequest feeder, click the Send button.


    Figure 18: Sending message from CreateRequest feeder
     
  4. 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
     
  5. Similarly, click Send in QueryRequest feeder.


    Figure 20: Sending message from QueryRequest feeder
     
  6. 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

References

Adaptavist ThemeBuilder EngineAtlassian Confluence