Get the tools you need to learn Java skills fast!
Video tutorials, eBooks, hands-on lab exercises, sample code.
Get started
The moose likes Web Services and the fly likes CXF -Endpoint - Binding object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "CXF -Endpoint - Binding object" Watch "CXF -Endpoint - Binding object" New topic

CXF -Endpoint - Binding object

Aruna Jayabalu

Joined: Aug 09, 2011
Posts: 13

I am using CXF webservice. I am trying to access the published endpoint in the Interceptor class.

Endpoint ep= null;
Bus bus = CXFBusFactory.getDefaultBus();
ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
List<Server> servers = serverRegistry.getServers();
Server targetServer = null;
for (Server server : servers) {
targetServer = server;
String address = server.getEndpoint().getEndpointInfo().getAddress();
ep = server.getEndpoint();
logger.debug("Endpoint ******* "+ep);
logger.debug("Endpoint Info******* "+ep.getEndpointInfo());

The above code works fine and I am able get the endpoint object.
With the endpoint object when I try to access the method ep.getBinding()
I need to setMTOMEnabled property on the binding object.

SOAPBinding binding = (SOAPBinding)ep.getBinding();

I am getting class cast exception. Cannot cast org.apache.cxf.binding.soap.SoapBinding cannot be cast to
It is expecting cxf.binding.soap.SoapBinding object. But there is no setMTOMEnabled in cxf SoapBinding.

Can you please suggest any solution for the above problem.

We have confirgured the below service factory in cxf-servlet.xml
<bean class=""/>

Will this create any problem?


It is sorta covered in the JavaRanch Style Guide.
subject: CXF -Endpoint - Binding object