Fast Infoset: JAX-RPC API to JAX-WS API migration.
By oleksiys on Mar 26, 2008
If you migrate a Web service client, written on top of the JAX-RPC API, to the newer JAX-WS API and need to keep it communicate using Fast Infoset – you need to follow easy migration procedure.
Very likely old code enables Fast Infoset using one of the following JAX-RPC API specific methods:
- Setting the System property
java -Dcom.sun.xml.rpc.client.ContentNegotiation=pessimistic ...
- Setting Content Negotiation on a Stub
stub = ...; // Obtain reference to stub
- Setting Content Negotiation on an instance of Call
call = ...; // Obtain reference to call call.setProperty(com.sun.xml.rpc.client.dii.CallPropertyConstants.CONTENT_NEGOTIATION_PROPERTY, "pessimistic");
For JAX-WS API based Web services, Fast Infoset could be enabled very similar way to JAX-RPC cases (2) and (3), described above. JAX-WS API uses different property name, though supported property values are same: “none”, “optimistic”, “pessimistic”.
After migration to a JAX-WS API, a Web service client will be represented either by Stub or Dispatcher object. However the Fast Infoset enabling procedure is the same for both representations. It's required to set Content Negotiation property on a Web service Stub or Dispatch.
So JAX-WS API specific way to enable Fast Infoset is following:
- Setting Content Negotiation on a Stub or Dispatch
stubOrDispatch = ...; // Obtain reference to Stub or Dispatch ((BindingProvider) stubOrDispatch).getRequestContext().put("com.sun.xml.ws.client.ContentNegotiation", "pessimistic");
 How to enable Fast Infoset
 Fast Infoset in Java Web Services Developer Pack, Version 1.6