1

客户端

 <cxf:jaxws-client
                        serviceClass="org.example.MyService"
                        port="MyServicePort"
                        operation="MyOperation">
                    <cxf:inInterceptors>
                        <spring:bean class="org.example.MyInInterceptor"/>
                    </cxf:inInterceptors>
                </cxf:jaxws-client>

如何从下面的拦截器中的 SOAP 响应中获取 SOAPBody?

public class MyInInterceptor extends AbstractSoapInterceptor {

    @Resource
    private WebServiceContext context;

    public MyInInterceptor() {

        super(Phase.RECEIVE);
    }

    @Override
    public void handleMessage(SoapMessage cxfSoapMessage) throws Fault {

         SOAPMessage soapMessage = cxfSoapMessage.getContent(SOAPMessage.class);
        System.out.println("soapMessage ===> " + soapMessage);  
           } 

}

4

0 回答 0