在CXF的SoapMessage中,BindingOperationInfo为null

时间:2016-08-05 07:27:51

标签: web-services soap cxf

我正在研究SOAP Web服务并从CXF的AbstractSoapInterceptor扩展了一个类,该类覆盖了

  

handleMessage(SoapMessage消息)

在这个方法中,我试图获取BindingOperationInfo,但它是NULL。我使用的是cxf 3.1.5版,但如果我使用的是cxf版本2.7.5,BindingOperationInfo将具有操作名称的值。

请找到下面的课程,

public class SoInterceptor extends AbstractWsHeaderInterceptor {

public SoInterceptor () throws JAXBException {
    super();
}

@Override
public void handleMessage(SoapMessage message) throws Fault {
     Exchange exchange = message.getExchange();
     BindingOperationInfo boi = exchange.getBindingOperationInfo();
     org.apache.cxf.endpoint.Endpoint endpoint = exchange.getEndpoint();
     org.apache.cxf.service.Service service =endpoint.getService();

}}

BindingOperationInfo从代码中获取null。如果我错过了什么,请告诉我。

1 个答案:

答案 0 :(得分:-1)

您可以改用

//Get the endpoint
Endpoint endpoint  = message.getExchange().get(Endpoint.class);

//Get the service called
Service service  = message.getExchange().get(Service.class);

//Get the details of the operation
OperationResourceInfo operation = message.getExchange().get(OperationResourceInfo.class);