7 Introduction to Optimizing XML Transmission Using Fast Infoset

An introduction and description of, how to enable and use Fast Infoset to optimize XML transmission for Oracle Infrastructure web services is detailed in this chapter.

It includes the following sections:

7.1 Overview of Fast Infoset

Fast Infoset is a compressed binary encoding format that provides a more efficient serialization than the text-based XML format. Fast Infoset optimizes both document size and processing performance.

When enabled, Fast Infoset converts the XML Information Set in the SOAP envelope into a compressed binary format before transmitting the data. Fast Infoset optimizes encrypted and signed messages, MTOM-enabled messages, and SOAP attachments, and supports both HTTP and JMS transports.

The Fast Infoset capability is enabled on all web services, by default. For web service clients, Fast Infoset is enabled if it is enabled on the web service and advertised in the WSDL.

You can explicitly enable and configure Fast Infoset on a web service or client, as described in the following sections.

7.2 Enabling Fast Infoset on Web Services

The Fast Infoset capability is enabled on a web service and advertised in the WSDL, by default. Follow one of these methods to enable Fast Infoset explicitly on a web service:

  • At design time, using com.oracle.webservices.api.FastInfosetService annotation. For example, following code excerpt provides an example of using the com.oracle.webservices.api.FastInfosetService annotation to enable and configure Fast Infoset on a web service at design time.

    package examples.webservices.fastinfoset;
    import com.oracle.webservcies.api.FastInfosetService;
    import oracle.webservices.annotations.PortableWebService;
    import javax.jws.WebMethod;
    
    @PortableWebService 
    @FastInfosetService(enabled = true) 
    public class HelloImplFastInfosetEnabled { 
       @WebMethod 
       public String hello(String name) { 
          return "Hello, " + name + "! (from FI Enabled Service)"; 
       } 
    } 
    

    For more information about the annotation, see "@FastInfosetService" in Securing Web Services and Managing Policies with Oracle Web Services Manager.

    For more information about the @PortableWebService annotation, see Java API Reference for Oracle Infrastructure Web Services.

  • Post-deployment, by attaching the oracle/fast_infoset_service_policy to the web service.

    For more information, see the following sections:

7.3 About Enabling and Configuring Fast Infoset on Web Services Clients

The Fast Infoset capability is enabled on a web service and advertised in the WSDL, by default. Follow one of these methods to explicitly enable and configure Fast Infoset on a web service client:

To enable and configure Fast Infoset on the client and on a web service at design time, see the following sections:

7.3.1 Content Negotiation Strategy

You can configure the content negotiation policy when enabling Fast Infoset on the client.

Table 7-1 summarizes the valid content negotiation strategies defined by com.oracle.webservices.api.FastInfosetContentNegotiationType.


Table 7-1 Content Negotiation Strategy

Value Description

OPTIMISTIC

Assumes that Fast Infoset is enabled on the service. All requests will be sent using Fast Infoset.

PESSIMISTIC

Initial request from client is sent without Fast Infoset enabled, but with an HTTP Accept header that indicates that the client supports the Fast Infoset capability. If the service response is in Fast Infoset format, confirming that Fast Infoset is enabled on the service, then subsequent requests from the client will be sent in Fast Infoset format.

NONE

Client requests will not use Fast Infoset.


Please note:

  • If the content negotiation strategy is configured explicitly on the client:

    • It takes precedence over the negotiation strategy advertised in the WSDL.

    • If the configured content negotiation strategy conflicts with the capabilities advertised by the service (for example, if the client configures OPTIMISTIC and the service has Fast Infoset disabled), then an exception is generated.

  • If the content negotiation strategy is not configured explicitly by the client:

    • If Fast Infoset is enabled and advertised on the service, the OPTIMISTIC content negotiation strategy is used.

    • If Fast Infoset is disabled and not advertised on the service, the NONE content negotiation strategy is used.

7.3.2 Using FastInfosetClientFeature Feature Class at Design Time

You can enable and configure Fast Infoset on a web service at design time using the com.oracle.webservices.api.FastInfosetClientFeature feature class.

The following code excerpt provides an example of using the com.oracle.webservices.api.FastInfosetClientFeature feature class.

package examples.webservices.fastinfoset;
import com.oracle.webservices.api.FastInfosetClientFeature;
import com.oracle.webservices.api.FastInfosetContentNegotiationType;
...
public class HelloServicePortClient {
    
    private static HelloServiceService helloServiceService;

    public static void main(String [] args)
    {
        FastInfosetContentNegotiationType clientNeg = 
            FastInfosetContentNegotiationType.PESSIMISTIC;
        FastInfosetClientFeature feature = FastInfosetClientFeature.builder().fastInfosetContentNegotiation(clientNeg).enabled(true).build(); 
        helloServiceService = new HelloServiceService();
        HelloService helloService = 
            helloServiceService.getHelloServicePort(feature);
...
}

7.4 Disabling Fast Infoset on Web Services and Clients

You can explicitly disable fast infoset on web services and clients at the design time.

To disable Fast Infoset explicitly:

The following code excerpt provides an example of using the com.oracle.webservices.api.FastInfosetService annotation to disable Fast Infoset on a web service at design time.

package examples.webservices.fastinfoset;
import com.oracle.webservices.api.FastInfosetService;
...
@PortableWebService 
@FastInfosetService(enabled = false) 
public class HelloImplFastInfosetDisabled{ 
   @WebMethod 
   public String hello(String name) { 
      return "Hello, " + name + "! (from FI Disabled Service)"; 
   } 
} 

At post-deployment time, to disable Fast Infoset:

  • Detach the oracle/fast_infoset_service_policy or oracle/fast_infoset_client_policy policy from the web service or client, respectively.

    For complete details, see the following sections:

  • To disable Fast Infoset globally, at a higher scope on a web service or client, define a policy set that includes oracle/no_fast_infoset_service_policy or oracle/no_fast_infoset_client_policy policy, respectively.

    For complete details, see the following sections: