Using the HTTP Binding Component

Using Application Variables to Define Name/Value Pairs

The binding component Application Variables property allows you to define a list of name:value pairs for a given stated type. The application variable name can be used as a token for a WSDL extensibility element attribute in a corresponding binding. For example, if you were defining an application variable for the hostname as FOO, then the WSDL attribute would be ${FOO}. In the Application Variables property you would enter a String value of FOO for the name, and the desired attribute as the value. When you deploy an application that uses application variables, any variable that is referenced in the application's WSDL is loaded automatically.

Graphic shows the HTTP Binding Component Runtime Properties
Editor and the dialog box used to set the Application Variable type.

The Application Variables configuration property offers four variable types:

Variables also allow greater flexibility for your WSDL files. For example, you can use the same WSDL for different runtime environments by using application variables to specify system specific information. These values can then be changed from the binding component runtime properties as needed, for any specific environment.

When you deploy an application that uses Application Variables, all of the Application Variables that are referenced in the application's WSDL files are loaded automatically. If you attempt to start an application and an Application Variables value is not defined (no value is specified for the Application Variable) an exception is thrown.

To change a property when the application is running, change your Application Variable property value, then right-click your application in the Services window under Servers -> GlassFish -> JBI -> Service Assemblies, and click Stop in the popup menu. When you restart your project, your new settings will take effect.

Using Application Variables for password protection

To protect passwords that would otherwise appear as clear text in your WSDL file, you can enter a Password application variable as a token. In the following example, a password application variable is created that uses the name SECRET and the password PROTECT.

ProcedureCreating a password Application Variable

  1. From the Binding Components directory, under Servers -> GlassFish -> JBI in the Servers window, select the sun-http-binding.

    The sun-http-binding Properties appear in the Properties window.

  2. Click-on the Application Variables property ellipsis (...) button.

    The Application Variables editor appears.

  3. Click Add, select Password as your variable type, and click OK.

    A new row is added to the Application Variables editor.

  4. Enter SECRET as the name, and enter PROTECT as the value.

    Because this is a password type, the characters of your password are displayed as asterisks.

  5. Use the application variable name ${SECRET} as your WSDL password attribute, using the dollar sign and curly braces as shown.