Creating the Web Service MakeConnection WS-Policy File Optional

Invoking Web Services Asynchronously 3-19 The MC Initiator receives the response message and terminates the MakeConnection polling mechanism. MakeConnection transport is recommended when using asynchronous invocation from behind a firewall. For a list of programming models supported, see Table 3–2, Transport Types for Invoking Web Services Asynchronously . The following sections describe how to enable and configure MakeConnection on a Web service and client: ■ Section 3.6.1, Enabling and Configuring MakeConnection on a Web Service ■ Section 3.6.2, Enabling and Configuring MakeConnection on a Web Service Client

3.6.1 Enabling and Configuring MakeConnection on a Web Service

MakeConnection can be enabled by attaching a MakeConnection policy assertion to the Web service and then calling its methods from a client using the standard JAX-WS client APIs. A policy can be attached to a Web service in one of the following ways: ■ Adding an Policy annotation to the JWS file. You can attach a MakeConnection policy at the class level only. ■ Adding reference to the policy to the Web service WSDL. The following sections describe the steps required to enable MakeConnection on a Web service: ■ Section 3.6.1.1, Creating the Web Service MakeConnection WS-Policy File Optional ■ Section 3.6.1.2, Programming the JWS File to Enable MakeConnection

3.6.1.1 Creating the Web Service MakeConnection WS-Policy File Optional

A WS-Policy file is an XML file that contains policy assertions that comply with the WS-Policy specification. In this case, the WS-Policy file contains Web service MakeConnection policy assertions. WebLogic Server includes pre-packaged WS-Policy files that contain typical MakeConnection assertions that you can use if you do not want to create your own WS-Policy file. The pre-packaged WS-Policy files that support MakeConnection are listed in the following table. In some cases, both reliable messaging and MakeConnection are enabled by the policy. For more information, see Appendix A, Pre-packaged WS-Policy Files for Web Services Reliable Messaging and MakeConnection . Note: You can attach MakeConnection policies at the class level only; you cannot attach the MakeConnection policies at the method level. Table 3–9 Pre-packaged WS-Policy Files That Support MakeConnection Pre-packaged WS-Policy File Description Mc1.1.xml Enables MakeConnection support on the Web service and specifies usage as optional on the Web service client. The WS-Policy 1.5 protocol is used. See Section A.5, Mc1.1.xml WS-Policy File . 3-20 Programming Advanced Features of JAX-WS Web Services for Oracle WebLogic Server You can use one of the pre-packaged MakeConnection WS-Policy files included in WebLogic Server; these files are adequate for most use cases. You cannot modify the pre-packaged files. If the values do not suit your needs, you must create a custom WS-Policy file. For example, you may wish to configure support of MakeConnection as required on the Web service client side. The MakeConnection policy assertions conform to the WS-PolicyAssertions specification at http:www.ibm.comdeveloperworkslibraryspecificationws-polas . To create a custom WS-Policy file that contains MakeConnection assertions, use the following guidelines: ■ The root element of a WS-Policy file is always wsp:Policy. ■ To configure Web service MakeConnection, you simply add a wsmc:MCSupported child element to define the Web service MakeConnection support. ■ The wsmc:MCSupported child element contains one policy attribute, Optional, that specifies whether MakeConnection must be configured on the Web service client. This attribute can be set to true or false, and is set to true by default. If set to false, then use of MakeConnection is required and both the ReplyTo and FaultTo if specified headers must contain MakeConnection anonymous URIs. The following example enables MakeConnection on the Web service and specifies that MakeConnection must be enabled on the Web service client. In this example, the WS-Policy 1.5 protocol is used. ?xml version=1.0? wsp15:Policy xmlns:wsp15=http:www.w3.orgnsws-policy xmlns:wsmc=http:docs.oasis-open.orgws-rxwsmc200702 wsmc:MCSupported wsp15:Optional=false wsp15:Policy Mc.xml Enables MakeConnection support on the Web service and specifies usage as optional on the Web service client. The WS-Policy 1.2 protocol is used. See Section A.6, Mc.xml WS-Policy File . Reliability1.2_ExactlyOnce_ WithMC1.1.xml Specifies policy assertions related to quality of service. It enables MakeConnection support on the Web service and specifies usage as optional on the Web service client. See Section A.7, Reliability1.2_ ExactlyOnce_WithMC1.1.xml WS-Policy File . Reliability1.2_ SequenceSTR.xml Specifies that in order to secure messages in a reliable sequence, the runtime will use the wsse:SecurityTokenReference that is referenced in the CreateSequence message. It enables MakeConnection support on the Web service and specifies usage as optional on the Web service client. See Section A.8, Reliability1.2_SequenceSTR.xml WS-Policy File . Reliability1.0_1.2.xml Combines 1.2 and 1.0 WS-Reliable Messaging policy assertions. The policy assertions for the 1.2 version MakeConnection support on the Web service and specifies usage as optional on the Web service client. This sample relies on smart policy selection to determine the policy assertion that is applied at runtime. See Section A.12, Reliability1.0_1.2.xml WS-Policy File . Table 3–9 Cont. Pre-packaged WS-Policy Files That Support MakeConnection Pre-packaged WS-Policy File Description Invoking Web Services Asynchronously 3-21

3.6.1.2 Programming the JWS File to Enable MakeConnection