thomas
thomas

Reputation: 115

Generic CXF server implementation

I'm currently working on a project using Spring Boot as well as CXF. I have successfully created a SOAP-client as well as a SOAP-server for a specific webservice (with a related WSDL). Works like a charm.

Now I need to implement some kind of proxy server, which just interprets the SOAP-Header (Security, Custom Headers) and routes the SOAP-Service to a different backend depending on the content of the custom headers.

But I haven't found an option to handle a service call generically. All online solutions suggest me to have all the WSDLs of the different proxied services in the proxy and to generate an internal cxf-model.

Is there a way to accomplish this without WSDL / internal model? Haven't found a solution yet.

One approach I followed was to implement a custom CXF Implementor and bind it to an endpoint.

@Bean
public Endpoint endpoint()
{
        EndpointImpl endpoint = new EndpointImpl(springBus(), customImplementor);
        endpoint.publish("/proxy");

        return endpoint;
}

But there isn't an implementor interface I can extend.

Do I miss smth here? What are your suggestions?

Upvotes: 0

Views: 348

Answers (2)

Karthik Prasad
Karthik Prasad

Reputation: 10034

Why not use cxf-camel and create proxy service, it has ability to route based on the your requirement that is header param based. Here is basic example implementation of the proxy service using spring-boot-cxf and spring-boot-camel

Upvotes: 1

fingerprints
fingerprints

Reputation: 2970

Sounds like if you need handlers... Just define an interceptor class and them do something like this.

@Bean
public Endpoint endpoint()
{
    InterceptorClass handler = context.getBean(InterceptorClass.class);
    EndpointImpl endpoint = new EndpointImpl(springBus(), customImplementor);
    endpoint.setHandlers(Arrays.asList(handler));
    endpoint.publish("/proxy");

    return endpoint;
}

Check an example here Oracle Doc of how create an interceptor class.

Upvotes: 1

Related Questions