Configuring the HTTP transport policy
When working with policy sets in the administrative console, you can customize policies to ensure message security. You can customize the Hypertext Transfer Protocol (HTTP) transport policy configuration or use the policy as it is provided with the default settings.
Before you begin
About this task
You can configure HTTP transport with the HTTP transport policy. HTTP is an application-level protocol for distributed, collaborative, hypermedia information systems. It is a generic, stateless, protocol that can be used for many tasks beyond its use for hypertext, such as name servers and distributed object management systems, through extension of request methods, error codes and headers. A feature of HTTP is the typing and negotiation of data representation, allowing systems to be built independently of the data being transferred. HTTP features and HTTP connections properties are applied to outbound messages for both the service client and service provider.
You can only configure a policy through a policy set. Therefore, before you can configure the HTTP transport policy, a policy set must exist that contains the HTTP transport policy. The provided default WSHTTPS policy set is read only and it cannot be edited. To customize a policy set that contains the HTTP transport policy, you must first create a copy of the WSHTTPS default policy set or create a new policy set and add the HTTP transport policy to the new policy set.
After you have created a copy of the WSHTTPS default policy set or created a new policy set with the HTTP transport policy added, you can customize the HTTP transport policy. Use the HTTP transport policy settings panel to customize the values of the HTTP transport policy properties such as read or write timeout values. Your customized values for the HTTP transport policy now apply for your policy set that contains that custom HTTP transport policy. You can attach this policy set containing your customized HTTP transport policy to your Java API for XML-Based Web Services (JAX-WS) application, its services, endpoints, or operations. This change affects all JAX-WS applications to which that policy set is attached. To learn more about attaching policy sets to applications, see the documentation for managing policy sets for service providers and service clients at the application level.
For example, if you have multiple policy sets, mypolicyset1 and mypolicyset2, containing the HTTP transport policy, you can customize the HTTP transport policy for each policy set to reflect different properties, such as timeout values. Now, you can attach these customized policy sets to one or more applications and these applications will use the HTTP property values associated with the HTTP transport policy that is contained within the attached policy set.
Procedure
Results
Example
You can attach policy sets to an application, its services, endpoints, or operations. In this example scenario, suppose you have two different JAX-WS service clients for your application, but you want to use different HTTP transport property values for each service client. Specifically, you want to configure a different read or write timeout value for each service client. To modify the HTTP timeout values, you can edit the values of the HTTP transport policy that is contained within the policy set that is attached to your application or in this case, your service client. This change affects all applications to which the policy set containing the custom HTTP transport policy is attached.
- There are two JAX-WS service clients, ServiceClient1 and ServiceClient2, that are deployed in the application server.
- The HTTP transport policy has not been previously attached to these applications.
- Create two new policy sets and add the HTTP transport policy to
them. For example: HTTPServiceClient1Policy and HTTPServiceClient2Policy
- Click .
- Enter the name of the new application policy set, HTTPServiceClient1Policy.
- From the Policies collection, click .
- Click and to save your changes to the master configuration.
- Repeat these steps to create the HTTPServiceClient2Policy.
- Customize the HTTP transport policy settings for the newly created
HTTPServiceClient1Policy and HTTPServiceClient2Policy policy sets.
For example, customize the read and write timeout values for the HTTP
transport policy contained in the HTTPServiceClient1Policy policy
set and the connection timeout value for the HTTP transport policy
contained in the HTTPServiceClient2Policy policy set.
- Click HTTPServiceClient1Policy .
- From the Policies collection, click .
- From the HTTP transport policy configuration panel, change the HTTP connection read and write timeout values to 500 seconds.
- Click and to save your changes to the master configuration.
- Click HTTPServiceClient2Policy .
- From the Policies collection, click .
- From the HTTP transport policy configuration panel, change the HTTP connection timeout value to 360 seconds.
- Click and to save your changes to the master configuration.
- Attach the custom HTTP transport policy, HTTPServiceClient1Policy,
to your application, ServiceClient1. Similarly, attach the custom
HTTP transport policy, HTTPServiceClient2Policy, to ServiceClient2.
- Click ServiceClient1.
- From the Policy set attachments collection, select the service, ServiceClient1.
- Click and click on HTTPServiceClient1Policy.
- Click to save your changes to the master configuration.
- Click ServiceClient2.
- From the Policy set attachments collection, select the service, ServiceClient2.
- Click and click on HTTPServiceClient2Policy.
- Click to save your changes to the master configuration.
As a result, the ServiceClient1 application now has the HTTPServiceClient1Policy attached and the HTTP sessions will use a read and write timeout value of 500 seconds. The ServiceClient2 application has the HTTPServiceClient2Policy attached and the HTTP sessions will use a connection timeout value of 360 seconds.