简体   繁体   中英

How do I print a SOAP request message?

How do I print a SOAP request message sent to a webservice (CXF2)? I'm using Eclipse.

I want to see which fields it contains and build a SOAP message following this structure.

You just nedd to add a LoggingInterceptor : see cxf documentation

Object implementor = new GreeterImpl();
EndpointImpl ep = (EndpointImpl) Endpoint.publish("http://localhost/service", implementor);

ep.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
ep.getServer().getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor())

Or if you use Springframework

<bean id="quickFactory" class="org.apache.cxf.jaxws.JaxWsProxyFactoryBean">
    <property name="serviceClass" value="com.misc.PortType"/>
    <property name="address" value="${service.url}"/>
    <property name="inInterceptors">
        <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"/>
    </property>
    <property name="outInterceptors">
        <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"/>
    </property>
</bean>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM