views:

164

answers:

1

I've got code that looks like it should be correct based on what I can find, but the spewed output doesn't indicate that it's using FastInfoset. My understanding is the Accept should indicate it can accept Fastinfoset and the response would actually use it, meaning it's not text/xml as the response type. Any idea what I'm doing wrong? I've scoured with Google and I'm having a hard time finding much detail on how to use FastInfoset at all.

    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.getInInterceptors().add(new LoggingInInterceptor());
    factory.getOutInterceptors().add(new LoggingOutInterceptor());
    factory.setServiceClass( C360Server.class);
    factory.setAddress("http://localhost:8501/cxfcontroller/cl_v5");
    C360Server client = (C360Server)factory.create();
    ((BindingProvider)client).getRequestContext().put(
        "com.sun.xml.ws.client.ContentNegotiation", "optimistic");

    C360Request requestTrans = new C360Request();
    ... code to fill in the request ...
    C360Response response = client.findContacts( requestTrans );

The logging doesn't seem to indicate FastInfoset is even attempted though:

INFO: Outbound Message
---------------------------
ID: 1
Address: http://localhost:8501/cxfcontroller/cl_v5
Encoding: UTF-8
Content-Type: text/xml
Headers: {SOAPAction=[""], Authorization=[Basic cWFfc3VwZXI6cWFfc3VwZXI=], Accept=[*/*]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soap:Body&gt;&lt;ns1:findContacts&gt;...bunch of xml deleted for brevity...</ns1:findContacts></soap:Body></soap:Envelope>
--------------------------------------
May 17, 2010 3:23:45 PM org.apache.cxf.interceptor.LoggingInInterceptor logging
INFO: Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml; charset=utf-8
Headers: {content-type=[text/xml; charset=utf-8], Content-Length=[611], Server=[Jetty(6.1.x)]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"&gt;&lt;soap:Body&gt;&lt;ns1:findContactsResponse&gt;...bunch of xml spew deleted for brevity...</ns1:findContactsResponse></soap:Body></soap:Envelope>
--------------------------------------

Any ideas what I'm doing wrong? Even if the server wasn't supporting FastInfoset, I still should see the attempted negotiation in the request, right?

+1  A: 

The answer is that the info I had on how to enable it was out of date. The following works on the client end (and presumably server end, but there I've got a Spring configuration enabled that handles it).

           JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
           // This enables FastInfoset as the communication protocol
           factory.getInInterceptors().add( new FIStaxInInterceptor() );
           factory.getOutInterceptors().add( new FIStaxOutInterceptor() );
           ... other code to set username, location, etc. goes here.
           client = (C360Server) factory.create();
Chris Kessel