Links: Table of Contents | Single HTML | Single PDF

Chapter 9. SOAP/TCP Web Service transport

Table of Contents

9.1. What is SOAP/TCP?
9.2. Creating a SOAP/TCP enabled Web Service
9.3. Configuring Web Service to be able to operate over SOAP/TCP transport
9.4. Deploying and Testing a Web Service with SOAP/TCP Transport Enabled
9.5. Creating a Client to Consume a SOAP/TCP-enabled Web Service
9.6. Configuring Web Service client to operate over SOAP/TCP transport

9.1. What is SOAP/TCP?

SOAP/TCP is TCP transport for Web Services. By default SOAP/TCP uses FastInfoset encoding in stateful mode, which lets SOAP/TCP to index XML elements optimal way, taking into account specifics of each concrete Web Service.

9.2. Creating a SOAP/TCP enabled Web Service

For detailed instructions for how to use NetBeans IDE to create a web service, see Creating a Web Service.

9.3. Configuring Web Service to be able to operate over SOAP/TCP transport

To use the IDE to configure a web service transport, perform the following steps.

To Configure SOAP/TCP transport in a Web Service

  1. In the IDE Projects window, expand the Web Services node, right-click the CalculatorWSService node, and choose Edit Web Service Attributes.

    The Web Service Attributes editor appears.

  2. Select the Allow TCP Transport check box, as shown in Enabling SOAP/TCP, and click OK.

    This setting configures the web service to be able to operate over SOAP/TCP transport additionally to the default HTTP.

    Figure 9.1. Enabling SOAP/TCP

    Enabling SOAP/TCP

9.4. Deploying and Testing a Web Service with SOAP/TCP Transport Enabled

Now that you have configured the web service to be able to operate over SOAP/TCP, you can deploy and test it.

To Deploy and Test a Web Service with SOAP/TCP Enabled

To deploy and test the web service, perform the following steps.

  1. Right-click the project node and select Properties, then select Run.

  2. Type /CalculatorWSService?wsdl in the Relative URL field and click OK.

  3. Right-click the project node and choose Run.

    The IDE starts the web container, builds the application, and displays the WSDL file page in your browser.

    The following WSIT tags related to SOAP/TCP display in the WSDL file:

    Example 9.1. 

    <wsp:Policy wsu:Id="CalculatorWSPortBindingPolicy">
        <wsp:ExactlyOne>
            <wsp:All>
                <ns2:OptimizedTCPTransport enabled="true"/>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>

9.5. Creating a Client to Consume a SOAP/TCP-enabled Web Service

For detailed instructions for how to use NetBeans IDE to create a web service client, see Creating a Client to Consume a WSIT-Enabled Web Service.

9.6. Configuring Web Service client to operate over SOAP/TCP transport

To use the IDE to configure a web service client transport, perform the following steps.

To Configure SOAP/TCP transport in a Web Service client

  1. In the IDE Projects window, expand the Web Service References node, right-click the CalculatorWSService node, and choose Edit Web Service Attributes.

    The Web Service Attributes editor appears.

  2. Select the Automatically Select Optimal Transport (HTTP/TCP) check box, as shown in Enabling SOAP/TCP for a Web Service client, and click OK.

    This setting configures the web service client to choose SOAP/TCP transport as prefferable, when working with a Web Service.

    Figure 9.2. Enabling SOAP/TCP for a Web Service client

    Enabling SOAP/TCP for a Web Service client

    After checking the SOAP/TCP check box, new policy assertions will be added to the Web Service client policy configuration file. Open CalculatorWSService.xml file, which is situated under the project's Source Packages/META-INF folder.

    The following WSIT tags related to SOAP/TCP display in the Web Service client configuration file:

    Example 9.2. 

    <wsp:Policy wsu:Id="CalculatorWSPortBindingPolicy">
        <wsp:ExactlyOne>
            <wsp:All>
                <tcp:AutomaticallySelectOptimalTransport/>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>