Administration Console Online Help

Previous Next Open TOC in new window
Content starts here

Attach a WS-Policy file to a Web service

Before you begin

You must install a Web service before you can associate a WS-Policy file with it. See Install a Web service.


A Web service can have zero or more WS-Policy files associated with it. WS-Policy files follow the guidelines of the WS-Policy specification. WebLogic Server uses WS-Policy files to specify the details of the message-level security (digital signatures and encryption) and reliable messaging capabilities of a Web service.

You can attach a WS-Policy file to a Web service endpoint, which means that the policy assertions apply to all the operations of a Web service endpoint. You can also attach a WS-Policy file to an operation, which means that the policy assertions apply only to the specific operation.

In addition, you can attach a WS-Policy file to the inbound or outbound SOAP message, or both. For example, if a WS-Policy file that specifies encryption for the body of a SOAP message is attached to just the inbound message of a particular operation, only the SOAP request needs to be encrypted.

Programmers, when creating the Web service, can use the Java Web service (JWS) annotation @Policy inside the implementation Java file of the Web service to attach a WS-Policy file. Administrators modify or attach additional WS-Policy files at runtime using the Administration Console, as described in this procedure.

After you have attached a WS-Policy file to a Web service endpoint or operation, the assistant updates the application's deployment plan. If the application does not currently have a configured deployment plan, the assistant creates one for you in the location you specify.

Types of Policies

You can attach two types of policies to WebLogic Web Services, as summarized in the following table.

Policy Type Description
Oracle Web Services Manager (Oracle WSM) Provided by Oracle WSM. For more information about the Oracle WSM and predefined policies, see Understanding Oracle WSM Policy Framework in Security and Administrator's Guide for Web Services.
WebLogic Web Service Policy Provided by Oracle WebLogic Server. For more information about the WebLogic Web service policies, see Securing WebLogic Web Services for Oracle WebLogic Server.

Pre-packaged WebLogic Web Service Policies

WebLogic Server includes pre-packaged WS-Policy files that you can use for configuring message-level security and reliable messaging, including the following. These files are static and you cannot change them. Predefined policies are available in the following categories:

Pre-packaged Oracle WSM Policies

Oracle WSM includes a set of predefined policies in the following categories: security, WS-Addressing, MTOM, reliable messaging, and management. For specific details, see Predefined Policies in Security and Administrator's Guide for Web Services.

Using Custom Oracle WebLogic Web Service Policies

The Web service programmer can include additional WS-Policy files in the J2EE module or application in which the service is packaged, or a shared J2EE library might be deployed that contains additional WS-Policy files. As with the pre-packaged policies, programmers use the Java Web service (JWS) annotation @Policy inside the implementation Java file of the Web service to attach a custom WS-Policy file.

You can also use the Administration Console to attach custom WebLogic Web service policy files to your Web service. To make the custom WebLogic Web service policies available so that you can attach them, perform one of the following steps:

Note:

The Administration Console allows you to associate as many WS-Policy files as you want to a Web service and its operations, even if the policy assertions in the files contradict each other. It is up to you to ensure that multiple associated WS-Policy files work together. If any contradictions do exist, WebLogic Server will return a runtime error when a client application invokes the Web service.

To associate a WS-Policy file with a Web service:

  1. If you have not already done so, in the Change Center of the Administration Console, click Lock & Edit (see Use the Change Center).
  2. In the left pane of the Administration Console, select Deployments.
  3. In the right pane, navigate within the Deployments table until you find the Web service for which you want to configure a WS-Policy file.

    Note: Web services are deployed as part of an Enterprise application, Web application, or EJB. To understand how Web services are displayed in the Administration Console, see View installed Web services.

  4. In the Deployments table, click the name of the Web service.
  5. Select Configuration -> WS-Policy.

    The table lists the WS-Policy files that are currently associated with the Web service. The top level lists all the ports of the Web service. Click the + next to a Web service port to see its operations and associated WS-Policy files.

  6. To associate a WS-Policy file with an entire Web service endpoint (port):
    1. Click the name of the Web service port. A page appears which includes two columns: one labelled Available Endpoint Policies that lists the names of the WS-Policy files that you can attach to a Web service endpoint and one labelled Chosen Endpoint Policies that lists the WS-Policy files that are currently configured for this endpoint.
    2. Use the arrows to move WS-Policy files between the available and chosen columns. The WS-Policy files that are in the Chosen column are attached to the Web service endpoint.
    3. Click OK.

      If your Web service already has a deployment plan associated to it, then the newly attached WS-Policy files are displayed in the Policies column in the table.

      If the J2EE module of which the Web service is a part does not currently have a deployment plan associated with it, the assistant asks you for the directory that should contain the deployment plan. Use the navigation tree to specify a directory, then click Finish.

  7. To associate a WS-Policy file with a Web service operation:
    1. Click the name of the operation. A page appears which includes two columns: one labeled Available Message Policies that lists the names of the WS-Policy files that are available to attach to the inbound (request) and outbound (response) SOAP message of the operation invoke and one labeled Chosen Message Policies that lists the WS-Policy files that are currently attached to the inbound and outbound SOAP message of the operation invoke.
    2. Use the arrows to move WS-Policy files between the available and chosen columns. The WS-Policy files that are in the Chosen column are the ones that are attached to the inbound and outbound SOAP message when this operation is invoked by a client application.
    3. Click Next.
    4. A page appears which includes two columns: one labeled Available Inbound Message Policies that lists the names of the WS-Policy files that are available to attach to the inbound (request) SOAP message of the operation invoke and one labeled Chosen Outbound Message Policies that lists the WS-Policy files that are currently attached to the inbound SOAP message of the operation invoke.
    5. Use the arrows to move WS-Policy files between the available and chosen columns. The WS-Policy files that are in the Chosen column are the ones that are attached to the inbound (request) SOAP message when this operation is invoked by a client application.
    6. Click Next.
    7. A page appears which includes two columns: one labeled Available Outbound Message Policies that lists the names of the WS-Policy files that are available to attach to the outbound (response) SOAP message of the operation invoke and one labeled Chosen Outbound Message Policies that lists the WS-Policy files that are currently attached to the outbound SOAP message of the operation invoke.
    8. Use the arrows to move WS-Policy files between the available and chosen columns. The WS-Policy files that are in the Chosen column are the ones that are attached to the outbound (response) SOAP message when this operation is invoked by a client application.
    9. Click Finish.

      If your Web service already has a deployment plan associated with it, the attached WS-Policy files are displayed in the Policies column in the table.

      If the J2EE module of which the Web service is a part does not currently have a deployment plan associated with it, the assistant asks you for the directory that should contain the deployment plan. Use the navigation tree to specify a directory, then click Finish.

  8. To activate these changes, in the Change Center of the Administration Console, click Activate Changes.
    Not all changes take effect immediately—some require a restart (see Use the Change Center).

Back to Top