Problems migrating Java 11 with CXF

Asked

Viewed 33 times

0

I am migrating my application that is on Java 8 and CXF 2.7.10. I upgraded the Java version to 11 and CXF to the latest version. However, when generating WSDL the results are different. Another observation is that I am using the jakarta instead of javax of JAX-WS that was removed in java 11. Follow the source of an example of Webservice and also the version prints before upgrading and after upgrading of the Wsdls.

import java.util.Map;
import jakarta.jws.WebService;
import jakarta.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

    @WebService
    public interface HelloWorld {
    
        String sayHi(String text);
    
        String sayHiToUser(User user);
    
        @XmlJavaTypeAdapter(IntegerUserMapAdapter.class)
        Map<Integer, User> getUsers();
    }

The impl class:

import java.util.LinkedHashMap;
import java.util.Map;
import jakarta.jws.WebService;

@WebService(endpointInterface = "demo.hw.server.HelloWorld",
            serviceName = "HelloWorld")
public class HelloWorldImpl implements HelloWorld {
    Map<Integer, User> users = new LinkedHashMap<>();


    public String sayHi(String text) {
        System.out.println("sayHi called");
        return "Hello " + text;
    }

    public String sayHiToUser(User user) {
        System.out.println("sayHiToUser called");
        users.put(users.size() + 1, user);
        return "Hello "  + user.getName();
    }

    public Map<Integer, User> getUsers() {
        System.out.println("getUsers called");
        return users;
    }

}

wsdl print before updating: inserir a descrição da imagem aqui

wsdl print after update: inserir a descrição da imagem aqui

Does anyone know how I can solve?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.