javaweb-servicesjax-rsjax-wsspring-resttemplate

How to change jax-ws to jax-rs without client sens of changes


There is an application that was configured and has developed by JAX-WS; the piece of code like this:

@WebService(targetNamespace = "http://webservice.bulk.test.net/", serviceName = "BulkService")
@BindingType(value = SOAPBinding.SOAP12HTTP_BINDING)
@XmlSeeAlso({
        ObjectFactory.class
})
public class Bulk {

    @WebMethod
    @RequestWrapper(localName = "getProvinces", targetNamespace = "http://webservice.bulk.test.net/", className = "test.GetProvinces")
    @ResponseWrapper(localName = "getProvincesResponse", targetNamespace = "http://webservice.bulk.test.net/", className = "test.GetProvincesResponse")
    @Action(input = "http://webservice.bulk.test.net/Bulk/getProvincesRequest", output = "http://webservice.bulk.test.net/Bulk/getProvincesResponse")
    public void getProvinces(
            @WebParam(name = "username", targetNamespace = "") @XmlElement(nillable = false, required = true)
                    String username,
            @WebParam(name = "password", targetNamespace = "") @XmlElement(nillable = false, required = true)
                    String password,
...) {
}

According to this webservice, so many clients(jax-ws clients) are using.

I want to change the jax-ws to jax-rs without changing the client, another hand, the clients have no sens about the changes and do api-call as before.

Is it possible?


Solution

  • I solved this problem by separating soap layer from the application because of some reasons, first, used Jax-rs and Jax-ws endpoints simultaneously and secondly, is technical debt; due to separating soap from application, it is able to migrate to JDK-11 without any problems and thirdly, according to separating Soap from application, it is independent from JAX-WS clients except changing JAX-WS endpoints.