You are here: Integrating With CPQ Cloud > Use Cases > Use BML to Connect to an External Service

Use BML to Connect to an External Service


There are a number of external systems that CPQ Cloud may be communicating with, including ERP Systems, CRM Systems, external databases, cgi scripts, and more. When use cases call for representing objects and complicated product or pricing systems, we can often meet the needs directly in the CPQ Cloud application. However, when integrating with an ERP system or CRM, complexity may arise. Re-implementing existing services can be costly and cumbersome. And some domain-specific tasks are best dealt with in specific and targeted systems.

To deal with these needs, you can setup communication points between CPQ Cloud and the external system in question. By default, we provide Integration points through an XSL interface to some CRM systems. When the pre-built mapping and integration tools don't meet your needs, then BML can be used to send and receive messages directly from a given service.


ClosedBefore Beginning

Always abstract your data calls into util functions. This simplifies the process of communicating with the external service, and makes it easier to change in the future if necessary. You can use either POST or GET to communicate with the external server, using the standard BML functions urldatabypost and urldatabyget.

There are a few things to consider when choosing which protocol to use:

Your choice will depend on what your needs are, as well as the specifications of the web service that you are communicating with.

ClosedExample: Google Movie API

In order to find out what movies are playing in our area, we're going to harness Google's Movie API. I know that the API calls for "GET," but still use makeurlparam whenever possible to make it easy to switch between GET and POST if necessary:

Call the util function "Movies" from anywhere in my application, to find out what movies are playing in a given area.


ClosedVisit the Link Directly

  1. If you are using GET, type the URL into your browser to see the response directly. You can change the parameters by playing with the link.
  2. If you are using POST, one simple way to see the results is to create an HTML form and submit it.
  3. Our earlier example could be turned into a form like so:
    1. <!--test_submit.html-->

      <form action=""method="post">

      <input name="movies" value="San Francisco"/>

      <input type="submit">


  4. Save the form and open it in your browser, then hit the "Submit" button to send the post.
  5. The results of the post will be loaded on the screen, and the Firebug "Net" panel will have additional information about the result.

ClosedCheck your Parameters

You can pass a parameter object created by makeurlparams directly to the BML print statement, to see exactly what is being sent.

ClosedCheck the Error Logs

Sometimes the CPQ Cloud error logs will show information that the debugger doesn't.

ClosedCheck for Firewalls and Security Settings

Sometimes you will be able to visit a link directly, but a security setting could be blocking the CPQ Cloud server. Talk to the admin of the web service to find out if there are any access restrictions in place. The Ops team may be able to help verify if the connection is occurring as well.

ClosedSpecial Content Types

Sometimes a web service demands a specific content type be set for a request to succeed. For instance, some SOAP calls may not work if the Content-Type header has not been explicitly set to "text/xml." If you are able to invoke the service manually, but your BML code is not able to connect, this could be the problem.

To correct this, you can pass a fourth parameter into the "urldatabyget" and "urldatabypost" functions in BML. This optional fourth parameter is a dictionary that can be used to set values on the HTTP header. To set the header for SOAP content, write:

The requirements for the header may vary based on the web service. If you can contact the admin of the external service they may be able to provide this information; otherwise the Firebug "Net" panel includes header information that may assist in determining the requirements.


Related Topics Link IconSee Also