Skip to content

Complete Automation of Endpoint Initialization #6

@jonashackt

Description

@jonashackt

Autodetect everything needed to initialize javax.xml.ws.Endpoint completely based upon generated Class files.

Background: The cxf-spring-boot-starter-maven-plugin generates two Class files among others:
One representing your Service Endpoint Interface (SEI) - annotated with javax.jws.WebService - and another WebServiceClient class - which implements javax.xml.ws.Service. Both are needed to initialize the javax.xml.ws.Endpoint for publishing it with Apache CXF. In traditional way with Spring Boot, but without the cxf-spring-boot-starter, this is done like that:

@Bean
public WeatherService weatherService() {
    return new WeatherServiceEndpoint();
}

@Bean
public Endpoint endpoint() {
    EndpointImpl endpoint = new EndpointImpl(springBus, weatherService());        
    // CXF JAX-WS implementation relies on the correct ServiceName as QName-Object with
    // the name-Attribute´s text <wsdl:service name="Weather"> and the targetNamespace
    // "http://www.codecentric.de/namespace/weatherservice/"
    // Also the WSDLLocation must be set
    endpoint.setServiceName(weather().getServiceName());
    endpoint.setWsdlLocation(weather().getWSDLDocumentLocation().toString());
    endpoint.publish(PUBLISH_URL_ENDING);
    return endpoint;
}

@Bean
public Weather weather() {
    // Needed for correct ServiceName & WSDLLocation to publish contract first incl. original WSDL
    return new Weather();
}

Now the idea is, that this is all boilerplate - if you like to run your SOAP web services in a contract first manner. Because then, everything is quite clear from your starting point - the WSDL and XSD files. There you have already the Name of your Service and all it´s methods. It should be possible to initialize the CXF endpoint from that information. Prerequisites remain the generation of the Java classes via the cxf-spring-boot-starter-maven-plugin and a manual implementation of the Service Endpoint Interface (SEI), because that´s the place where you´re service coding starts - we shouldn´t generate that one for you.

With this feature, you dont´t have to do a lot any more - the hole Endpoint initialization (including the definition of a WebService URL) is done for you.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions