标签: fastinfoset

使用Apache CXF发送FastInfoset请求时,我可以在日志中使用XML吗?

我需要在应用程序的日志中提供请求和响应,但Apache CXF发送的请求在FastInfoset(Content-Type:application/fastinfoset)中,这导致请求和响应的日志不可读(因为它是二进制的) ).有没有办法解决这个问题,以便我保留FastInfoset消息(出于性能原因)但是我在日志中得到了正确的XML?

这是我现在拥有的CXF配置,如果有帮助的话:

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://cxf.apache.org/core"
    xsi:schemaLocation="
http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

    <bean id="logInbound" class="org.apache.cxf.interceptor.LoggingInInterceptor" />
    <bean id="logOutbound" class="org.apache.cxf.interceptor.LoggingOutInterceptor" />

    <cxf:bus>
        <cxf:inInterceptors>
            <ref bean="logInbound" />
        </cxf:inInterceptors>
        <cxf:outInterceptors>
            <ref bean="logOutbound" />
        </cxf:outInterceptors>
        <cxf:outFaultInterceptors>
            <ref bean="logOutbound" />
        </cxf:outFaultInterceptors>
        <cxf:inFaultInterceptors>
            <ref bean="logInbound" />
        </cxf:inFaultInterceptors>
    </cxf:bus>
</beans>
Run Code Online (Sandbox Code Playgroud)

预先感谢您的任何帮助.

java web-services cxf jax-ws fastinfoset

5
推荐指数
1
解决办法
187
查看次数

如何在JAXWS中使用FastInfoset?

根据我能找到的内容,我的代码看起来应该是正确的,但是输出的代码并不表示它正在使用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 );
Run Code Online (Sandbox Code Playgroud)

记录似乎并不表示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: …
Run Code Online (Sandbox Code Playgroud)

java jax-ws fastinfoset

4
推荐指数
1
解决办法
2515
查看次数

标签 统计

fastinfoset ×2

java ×2

jax-ws ×2

cxf ×1

web-services ×1