BPC-Components

Home > Products > BPC PowerForms - Silverlight > Knowledge Base > Web Services / Web Posts > Getting external values using web posts

Getting external values using web posts


You can retrieve information from web posts and use them inside your form.

For example, as soon as you select a customer from a combobox, you want to display the balance of the selected customer in a label next to the customer.

In order to achieve this, you must declare a new unbound control (you do now set the Target Field Name property) and place it inside the form.

Next, go to the Post Info tab and select Value Type="Url" Post.

Finally inside the Web Post Url property type the url you want to use to retrieve the required information.

For example :
http://servername/balance.aspx?id={c_Customer}

Where balance.aspx is a web page hosted inside a web site. The parameter {c_Customer}, will retrieve the selected value from the c_Customer combobox and use it to create the final uri for the web post.

The web post is asynchronus, so it may take some time from the user selection until the result appears on the form.

Note : In order to get the value, you should first allow the target web site to accept calls from the silverlight form.

To do that, you have to add a file called clientaccesspolicy.xml at the root of the site.

This file should look something like this:

<?xml version="1.0" encoding="utf-8"?>

<access-policy>

  <cross-domain-access>

    <policy>

      <allow-from http-request-headers="*"> 

        <domain uri="*" />

      </allow-from>

      <grant-to>

        <resource include-subpaths="true" path="/" />

      </grant-to>

    </policy>

  </cross-domain-access>

</access-policy>

IMPORTANT : The above file provides unlimited access to silverlight components trying to access the site. You have to setup the parameters inside the file according to your needs. See full documentantion for clientaccesspolicy.xml file Here.