weixin_30261353
咿呀嘿人生
2018-12-13 08:48

springBoot集成cxf发布WebService,发布报错

  • cxf
  • web service
  • springboot

最近项目在集成webservice,但是发布后无法查看WSDL。

目前已经到这一步了

图片说明

点击WSDL后,后台就报这个错
图片说明

求大神帮我看一下是什么原因导致的

以下是项目代码

接口

@WebService(name = "YgrhService",targetNamespace = "http://service.hospital.webservice.modules.x.xinjian.com")
public interface YgrhService {




    @WebMethod
    @WebResult(name = "String",targetNamespace = "")
    String uploadPatientInfo(@WebParam(name = "info") String info);

    @WebMethod
    User getUser(String userId);
}

实现类

@Component
@WebService(serviceName = "YgrhService",argetNamespace = "http://service.hospital.webservice.modules.x.xinjian.com",endpointInterface = "com.xinjian.x.modules.webservice.hospital.service.YgrhService")
public class YgrhServiceImpl implements YgrhService {
    private Map<String, User> userMap = new HashMap<String, User>();
    public YgrhServiceImpl() {
        System.out.println("向实体类插入数据");
        User user = new User();
        user.setUserId("411001");
        user.setUsername("zhansan");
        user.setAge("20");
        user.setUpdateTime(new Date());
        userMap.put(user.getUserId(), user);

        user = new User();
        user.setUserId("411002");
        user.setUsername("lisi");
        user.setAge("30");
        user.setUpdateTime(new Date());
        userMap.put(user.getUserId(), user);

        user = new User();
        user.setUserId("411003");
        user.setUsername("wangwu");
        user.setAge("40");
        user.setUpdateTime(new Date());
        userMap.put(user.getUserId(), user);
    }
    @Override
    public String uploadPatientInfo(String info) {

        return "liyd"+ info;
    }

    @Override
    public User getUser(String userId) {
        User user= userMap.get(userId);
        return user;
    }
}
配置文件
    @Configuration
public class TestConfig {


    @Autowired
    private  YgrhService ygrhService;

    @Bean
    public ServletRegistrationBean disServlet() {
        ServletRegistrationBean bean = new ServletRegistrationBean(new CXFServlet(), "/services/*");

        return bean;
    }
    @Bean(name = Bus.DEFAULT_BUS_ID)
    public SpringBus springBus() {
        return new SpringBus();
    }

    @Bean
    public Endpoint endpoint() {
        EndpointImpl endpoint = new EndpointImpl(springBus(), ygrhService);
        endpoint.publish("/YgrhService");
        return endpoint;
    }

}

domo

public class User {

    private static final long serialVersionUID = -5939599230753662529L;
    private String              userId;
    private String            username;
    private String            age;
    private Date updateTime;

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getAge() {
        return age;
    }

    public void setAge(String age) {
        this.age = age;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

1条回答

为你推荐

换一换