7 Introduction to Optimizing XML Transmission Using Fast Infoset
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.FastInfosetServiceannotation. For example, following code excerpt provides an example of using thecom.oracle.webservices.api.FastInfosetServiceannotation 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
@PortableWebServiceannotation, see Java API Reference for Oracle Infrastructure Web Services. -
Post-deployment, by attaching the
oracle/fast_infoset_service_policyto the web service.For more information, see the following sections:
-
"Attaching Policies to Web Services and Clients Using Fusion Middleware Control" in Securing Web Services and Managing Policies with Oracle Web Services Manager.
-
"Configuring Fast Infoset Using WLST" in Administering Web Services.
-
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:
-
At design time, using the
com.oracle.webservices.api.FastInfosetClientFeaturefeature class, as shown in Using FastInfosetClientFeature Feature Class at Design Time -
Post-deployment, by attaching
oracle/fast_infoset_client_policyto the web service.For more information, see the following sections:
-
"Attaching Policies to Web Services and Clients Using Fusion Middleware Control" in Securing Web Services and Managing Policies with Oracle Web Services Manager.
-
"Configuring Fast Infoset Using WLST" in Administering Web Services.
-
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 |
|---|---|
|
|
Assumes that Fast Infoset is enabled on the service. All requests will be sent using Fast Infoset. |
|
|
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. |
|
|
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
OPTIMISTICand 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
OPTIMISTICcontent negotiation strategy is used. -
If Fast Infoset is disabled and not advertised on the service, the
NONEcontent 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:
-
On a web service, set the
enabledflag tofalseon the annotation, as described in Enabling Fast Infoset on Web Services -
On a web service client, set the
enabledflag tofalseor set the content negotiation strategy toNONEon the annotation or Feature class, as described in About Enabling and Configuring Fast Infoset on Web Services Clients
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_policyororacle/fast_infoset_client_policypolicy from the web service or client, respectively.For complete details, see the following sections:
-
"Attaching Policies to Web Services and Clients Using Fusion Middleware Control" in Securing Web Services and Managing Policies with Oracle Web Services Manager.
-
"Configuring Fast Infoset Using WLST" in Administering Web Services.
-
-
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_policyororacle/no_fast_infoset_client_policypolicy, respectively.For complete details, see the following sections:
-
"Attaching Policies Globally Using Policy Sets" in Securing Web Services and Managing Policies with Oracle Web Services Manager.
-
"Attaching Policies Globally Using Policy Sets Using WLST" in Securing Web Services and Managing Policies with Oracle Web Services Manager.
-