我是高学超 2016-12-01 08:24 采纳率: 0%
浏览 7518

Spring boot 中使用webservice的问题

自己写完一个demo后,测试时得不到wsdl文档,下面贴上自己的代码

首先是发布服务用的接口
package com.pudding.tcs.ctrip.testservice;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface TestService {
@WebMethod
public String test(String param);
}

接下来是接口实现
package com.pudding.tcs.ctrip.testservice;
public class TestServiceImpl implements TestService {
@Override
public String test(String param) {
return "param="+param;
}
}
再接下来是配置类用于发布服务:
package com.pudding.tcs.ctrip.config;
import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.bus.spring.SpringBus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.pudding.tcs.ctrip.testservice.TestService;
import com.pudding.tcs.ctrip.testservice.TestServiceImpl;
@Configuration
public class TestConfig {
@Bean
public ServletRegistrationBean dispatcherServlet() {
return new ServletRegistrationBean(new CXFServlet(), "/soap/*");
}

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

@Bean
public TestService testService() {
return new TestServiceImpl();
}

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

}
按道理讲这样配置完之后我启动服务器,在地址栏输入http://localhost:8080/soap/test?wsdl是可以显示wsdl文档的。可是现在输完地址浏览器没有任何反应。不知道问题出在了哪里。

还望各路神仙给小弟解答一下

  • 写回答

1条回答 默认 最新

  • dabocaiqq 2017-01-14 15:24
    关注
    评论

报告相同问题?

悬赏问题

  • ¥15 github符合条件20分钟秒到账,github空投 提供github账号可兑换💰感兴趣的可以找我交流一下
  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?