Index Changes

Using application configuration in HTTP BC


Background


For BCs, application connectivity information is usually stored in the service extensibility elements in a WSDL.
The information includes connection properties such as hostname, port number, user name, password etc.
With the use of application configuration, you can change the connectivity parameters without redeploying the
application. Application configuration objects can be seen as a named object associated with an endpoint that
defines a set of connection properties for a specific binding protocol.

For HTTP BC, the connectivity information is basically the HTTP URL location defined on soap:address for SOAP binding,
or http:address for HTTP binding. This document focuses on how to use the application configuration feature
with HTTP BC.

Configuring Application Configuration Object on SOAP/HTTP Endpoints


1. An application configuration name can be associated with an endpoint using the CASA editor as shown below.
The configuration name is completely user defined. If an application configuration name is defined for an endpoint,
the set of connection properties associated with the configuration name will override the default
connection properties specified in the WSDL


  • Steps to Launch the CASA editor
    • Create a composite application project
    • Add the JBI project to the composite application project
    • Build the composite application project
    • Open the composite application node
    • Double click on the "Service Assembly" node to open the CASA editor
    • Once CASA editor is launched, edit the configuration name for the desired endpoint as shown below. Make
      sure you click on the 'C' or 'P' port to launch the correct properties editor.

CASA_app_config_object.png

2. An 'application-config' extension will be created in the consumes and/or provides element in the jbi.xml
in HTTP BC's service unit jar, after the composite application (service assembly) is built successfully.
Following is an example of the jbi.xml in HTTP BC's service unit jar. CASA editor and Comp(osite)App(lication) project is
designed to make this whole process easy, however, it is possible to manually add the application configuration
in the jbi.xml (take care to add it to the 'correct' consumes or provides element):
   <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
   <jbi xmlns="http://java.sun.com/xml/ns/jbi" xmlns:ns1="http://localhost/SynchronousSample/SynchronousSample"                    
        xmlns:ns2="http://enterprise.netbeans.org/bpel/SynchronousSample/SynchronousSample_1" version="1.0">
      <services binding-component="true">
         <consumes endpoint-name="port1" interface-name="ns1:portType1" service-name="ns1:service1">
             <application-config xmlns="http://www.sun.com/jbi/descriptor/configuration" name="myConfigObject"/>
         </consumes>
      </services>
   </jbi>


3. Now you can deploy the same composite application (service assembly) .zip file to any runtime environment.
To make sure that the endpoint address is appropriate for the runtime environment, you can define the actual value
for the application configuration:

  • Using NetBeans JBI Manager
    • Right click on "properties" menu item on HTTP BC
    • Click on the "..." button next to configuration property "Application Configuration Objects"
    • Add a new Application Object and define the value for the HTTP URL location:\


HTTPBC_config_properties.png

For better usability, HTTP BC loads the application configuration objects defined in the service
unit automatically when composite application(service assembly) is deployed - all application configuration objects
defined in the SA will be loaded in the "Application Configuration Objects" property. Of course, the connection
property associated with each application configuration needs to be defined correctly before the service unit
can be started properly.
The value for the HTTP URL location can also reference application variables, which is also a configuation property
available on HTTP BC. When a service unit is deployed, any application variables referenced are also loaded automatically
by HTTP BC. Proper token syntax (e.g. ${var1}) must apply and rules of where application variables may be defined in a HTTP URL
also need to be followed:
Application_config_with_application_variables.png
The service assembly can be started after all referenced application configurations and/or referenced application
variables are properly defined. In the example shown here, the HTTP URL location where the echo service is provided will
be "http://localhost:18181/helloworld given the application variables values defined below:
Application_variables_defined.png
  • Using asadmin CLI commands:
Here are the few important asadmin commands to create, update, delete and list application configurations defined in a binding component:
    • create-jbi-application-configuration
    • update-jbi-application-configuration
    • delete-jbi-application-configuration
    • list-jbi-application-configurtions


Here are some examples on how to use these commands with HTTP BC:

    • asadmin.bat create-jbi-application-configuration --component=sun-http-binding --configname=myConfigObject config.properties
where a typical config.properties looks like:
    configurationName=myConfigObject
    httpUrlLocation=http://locahost:12345/foo
Make sure that the value for 'configurationName' in the config.properties file matches that defined for "--configname" option.
    • asadmin.bat update-jbi-application-configuration --component=sun-http-binding --configname=myConfigObject config.properties
Same content format for the config.properties file. You could use this command to update the value for HTTP URL location
    • asadmin.bat delete-jbi-application-configuration --component=sun-http-binding testConfig1
This command deletes the application configuration object called testConfig1
    • asadmin.bat list-jbi-application-configurations --component=sun-http-binding
This shows all the application configuration objects defined in HTTP BC.

For detailed information on asadmin commands, please see http://wiki.open-esb.java.net/Wiki.jsp?page=SierraUpdateCLI

Starting a service assembly would require all referenced application configurations and/or application variables
to be defined, otherwise, an exception will thrown with detailed information on what's missing.
Changes in the application configuration definitions(i.e. httpUrlLocation value changes) will take affect only
after the service assembly is restarted. A sequence of shutdown/start steps are needed to update the location URL
if the application is already running.

JSPWiki v2.4.100
[RSS]
« Home Index Changes Prefs
This page (revision-12) was last changed on 09-Apr-09 13:40 PM, -0700 by Sherry Weng