Showing posts with label Web service server connector. Show all posts
Showing posts with label Web service server connector. Show all posts

Friday, 10 July 2020

Dell Boomi API Management-Configure Rest Based API for form Based Jason Response

Dell Boomi API Management
Most of you are familiar with Dell Boomi API management feature. APIs are implemented as deployable API components. There are two types: API Service and API Proxy. Using API components enables you to consolidate API design into a single, explicit location.
In API Service, we can define an endpoint using a Rest or Soap.

Configure API:
First we have to configure an API.Give your API a title and then a base path.As Shown in screen shot below.


Then go on Rest Tab and it will automatically configure path for you then click on Add End Point button.Configure you end point. Configure your input type and output type and create a process that will handle your request.As shown in screen shot.



Create Listener Process
Now create a process that will listen all the request send to API. In my example i am configuring a process that will get two inputs as API parameter and on the bases of those inputs insert data into salesforce.
Starting connector will be WebService Server Connector with Listen action. Create its operation with 
Operation Type = Get
Object= will be your resource path you configure during end point creation
Expected Input Type = Single Data
Response Output Type = Single Data
Result Content Type = text/plain


Then you have to use this groovy script so parameter values can be assigned to your variables.Below groovy script will be used.

import java.util.Properties;
import java.io.InputStream;

import org.apache.http.NameValuePair;
import org.apache.http.client.utils.URLEncodedUtils;
import java.nio.charset.StandardCharsets;

for( int i = 0; i < dataContext.getDataCount(); i++ ) {
    InputStream is = dataContext.getStream(i);
    Properties props = dataContext.getProperties(i);

    def input = is.text;
    def data = URLEncodedUtils.parse(input, StandardCharsets.UTF_8) as List<NameValuePair>;
    
    for ( NameValuePair arg: data ) {
        props.setProperty("document.dynamic.userdefined." + arg.name, arg.value);
    }
    
    dataContext.storeStream(is, props);
}

Now we have to use dynamic properties to get values from endpoints. Will create two dynamic process properties to get Account Id and Account Key. Dynamic process property name = AccountId and AccountKey. It will get value from our endpoint. Our endpoint is 

Http:Demo//ws/rest/Test/Lim?AID=123456&Key=444 

Dynamic Process Property Name = AccountId
Parameter = Dynamic document property with name = AID

Dynamic Process Property Name = AccountKey
Parameter = Dynamic document property with name = Key

Note: One thing to note here is that my dynamic process property names are same as my url parameter name. This is the key point to set variables. The bold words in my url are my parameters placeholder i have given the same name to my dynamic process property. This is how you can set values.

In my case we will use another dynamic process property to check that the account id and key combination is in salesforce or not.In the decision box will check if salesforce do not have this combination we will send an email alert if this combination exists we will insert data in salesforce.

Salesforce Connector

Configuring salesforce connector or mapping data is easy tasks and can be found in below links.












Friday, 25 March 2016

Configure Salesforce for On demand Integration Using Dell Boomi


In this post I will give you example of invoking Boomi process using Apex class.

Invoke Boomi Atom

You require an End point URL to invoke your Boomi atom. Boomi atom could be a cloud atom or an on premises atom (locally deployed atom). Below example will explain how to connect with on premises atom.

Login your Boomi environment and click on "Atom Management".Navigate to "Shared Web Server Setting" and copy "Base URL" of your on premises atom along with port.


Salesforce Remote Site Setting

When ever you access any external site from Salesforce you need to add that in remote site setting. This is a security layer that force.com platform will check.
Enter base URL in remote site setting in your salesforce organization. 

Apex Class

Below example demonstrate that how we can pass some parameter to Dell Boomi interface in the form of an XML.

In my previous post we created "End point URL". 

Now we will use our end point url in apex class and call our Boomi process simply by writing below code.

Note: This is a generic XML structure.XML structure may differ on the bases of response profile you created in Boomi.

 public static HttpResponse getInfoBoomi()
    {
        // Get the Endpoint URL from custom label      
        String EndPointUrl = Endpoint URL;
        Httprequest request = new Httprequest();
        request.setmethod('POST');
        request.setTimeout(120000);

        request.setEndpoint(EndPointUrl);
        //set the request string for Boomi service connector containing Invoice No which will than pass to SAP to get the Invoice Base64 code
        string strInput = '<?xml version="1.0" encoding="UTF-8"?>' +
            '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
            '   <soapenv:Body> <setOutput xmlns="https://secure.logmeinrescue.com/API/API.asmx"> 
            '      <notifications xmlns="http://soap.sforce.com/2005/09/outbound">' +
            '         <Notification> ' +
            '               <InvoceId>' + ApexPages.currentPage().getParameters().get(ID) + '</InvoceId>' +
            '         </Notification>' +
            '      </notifications>' +
            '   </soapenv:Body>' +
            '</soapenv:Envelope>';

        //replace all & with &amp; to avoid xml encoding issue                      

        strInput = strInput.replaceAll('&', '&amp;');
        request.setBody(strInput);
        Http httprequest = new Http();
        string responseMessage;
        HttpResponse res;
        //send http request to boomi process
        res = httprequest.send(request);
        return res;


    }

By calling above mention function "getInfoBoomi" will provide you http response coming from your Boomi process.You can use built in function getbody to extract your data from response file.

HttpResponse res = getInfoBoomi();
 sData = res.getbody();

This way you can invoke your Boomi process from Salesforce. Hope this helps you !




Tuesday, 9 February 2016

Configure Boomi On demand Integration Connector

The following post will show you how to configure web service connector which is used to establish an on-demand integration between Salesforce and SAP using Boomi as a middle-ware tool.

Boomi Web Service Connector:

On-demand integration use "Web Service Server" Connector. It does not count against boomi connection license. It is always use to listen request from "Source" system.
  •  Login your Boomi account.
  •  Create Component--> Process --> Write your Process Name--> Save
  •  Now configure your connector.
  •  Connector = Web Service Server
  • Action = Listen
 Create a new operation
  • Operation Type = Get
  • Object = Object used for Integration
  • Input Type = Single XML Object
  • Request Profile = Create profile
  • Output Type = Single XML Object
  • Response Profile = Create profile
In order to make connection between your Boomi account and Salesforce environment. We have to configure “Shared web server settings” in Boomi.
  1. Click on “Atom Management”.
  2. Select your Atom on which you have to configure your “Shared web server setting”.
  3. Click on “Shared web server setting” a popup box will appear. Click on “Basic” tab. You have to enable port 9090 and get the base URL of your server.
  4. Now click on “Authentication” tab and check your settings.
    1. None mean only “Boomi Account ID” to make connection
    2. Basic means “Boomi Account ID” and “Security Token” both are required to make connection.
  5. Now click on “User Management” tab. Click on “Generate” button to get security token for your user account copy this security token.
  6. Now click on “Setup” navigate to “Account Information” tab and copy “Account Id”.
  7. In order to create a complete connection URL we have to follow below syntax:

    URL: <Server Base URL><Port><Operation URL>;boomi_auth=<AccountID>:<Security Token>
Note:
  • <AccountID>:<Security Token> will be base64 encode.
  • Sometime Connection URL give authentication error due to firewall security on atom server for that specific case you have to white-list salesforce public IPs on atom server and get a specific IP of your atom server which will be replace your “Base URL” in your connection URL.