我得到的代碼看起來應該是正確的,基於我能找到的東西,但是這個被噴出的輸出並不表示它正在使用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,我仍然應該在請求中看到嘗試的協商,對吧?