我得到的代码看起来应该是正确的,基于我能找到的东西,但是这个被喷出的输出并不表示它正在使用FastInfoset。我的理解是Accept应该表明它可以接受Fastinfoset,并且响应实际上会使用它,这意味着它不是text/xml作为响应类型。任何想法我做错了什么?我已经和谷歌一起搜索了,而且我很难找到关于如何使用FastInfoset的更多细节。你如何在JAXWS中使用FastInfoset?
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);
的记录似乎并不表明FastInfoset是,即使尝试:
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/"><soap:Body><ns1:findContacts>...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/"><soap:Body><ns1:findContactsResponse>...bunch of xml spew deleted for brevity...</ns1:findContactsResponse></soap:Body></soap:Envelope>
--------------------------------------
任何想法我做错了吗?即使服务器不支持FastInfoset,我仍然应该在请求中看到尝试的协商,对吧?