4

見つけたものに基づいて正しいと思われるコードを取得しましたが、吐き出された出力は、FastInfoset を使用していることを示していません。私の理解では、Accept は Fastinfoset を受け入れることができることを示す必要があり、応答は実際にそれを使用します。つまり、応答タイプとして text/xml ではないということです。私が間違っていることは何か分かりますか?私は Google で精査しましたが、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 をサポートしていなかったとしても、要求で試行されたネゴシエーションが表示されるはずですよね?

4

2 に答える 2

6

答えは、それを有効にする方法について私が持っていた情報が古かったということです。以下はクライアント側で機能します(おそらくサーバー側ですが、それを処理するSpring構成が有効になっています)。

           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();
于 2010-06-03T21:05:22.053 に答える
0
//Enabling FastInfoset by configuring proxy 
// Enabling FI in pessimistic mode
Map<String, Object> ctxt = ((BindingProvider)proxy).getRequestContext();
ctxt.put(JAXWSProperties.CONTENT_NEGOTIATION_PROPERTY, "pessimistic");

また

システム プロパティを使用して FastInfoset を有効にする

-Dcom.sun.xml.ws.client.ContentNegotiation=pessimistic
于 2011-10-04T20:52:24.633 に答える