Search code examples
javaspringspring-bootsoapjax-ws

Using JaxWsPortProxyFactoryBean, or an equivalent, in Spring Boot 3?


I'm trying to upgrade a project that makes use of org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean in Spring Boot 2.7.5 to Spring Boot 3. Here's the declaration of my bean:

@Bean
public JaxWsPortProxyFactoryBean myJaxWsClient() {
    JaxWsPortProxyFactoryBean jaxWsPortProxyFactoryBean = new JaxWsPortProxyFactoryBean();
    jaxWsPortProxyFactoryBean.setJaxWsService(new My_Service());
    jaxWsPortProxyFactoryBean.setWsdlDocumentUrl(Thread.currentThread().getContextClassLoader().getResource("META-INF/my.wsdl"));
    jaxWsPortProxyFactoryBean.setNamespaceUri("urn:net:something");
    jaxWsPortProxyFactoryBean.setServiceName("MyService");
    jaxWsPortProxyFactoryBean.setServiceInterface(My.class);
    jaxWsPortProxyFactoryBean.setEndpointAddress("http://someuri:7979/myservice");
    jaxWsPortProxyFactoryBean.setUsername("username");
    jaxWsPortProxyFactoryBean.setPassword("password");
    return jaxWsPortProxyFactoryBean;
}

However, org.springframework.remoting.jaxws.JaxWsPortProxyFactoryBean doesn't seem to be available in Spring Boot 3, or it has moved to another library.

My question is: How do I use JaxWsPortProxyFactoryBean in Spring Boot 3, or how do I migrate to a more modern alternative (if available)?


Solution

  • This class, as many others, has been removed in Spring Framework 6 (which is used by Spring Boot 3). It has been documented by this Github ticket and this commit. The old style remoting support (due to vulnerabilities and better options available) has been removed from the core library.

    For the JAX-WS part you probably want to use something like Apache CXF in the current day and age, which would allow for a dynamic proxy. Another option is to implement the client yourself using Spring Web Services