首页 > 编程语言 > 详细

spring配置jax-ws

时间:2018-02-07 14:11:27      阅读:237      评论:0      收藏:0      [点我收藏+]

在spring配置文件中新建bean,在该bean中添加指定的访问地址,注意最后的"/"必须要写。

    @Bean
    public static SimpleJaxWsServiceExporter getSimpleJaxWsServiceExporter(){
        SimpleJaxWsServiceExporter wsServiceExporter = new SimpleJaxWsServiceExporter();
        wsServiceExporter.setBaseAddress("http://localhost:8088/sgyws/");
        return wsServiceExporter;
    }

然后新建一个接口

@WebService
public interface SgyWs {

    @WebMethod
    public String sayHi(); 
}

再有一个实现类,该类上的注解serviceName为ws的服务名,endpointInterface为接口地址。

@WebService(serviceName="sgyService",endpointInterface="com.btw.sgy.webService.SgyWs")
//@SOAPBinding(style=Style.RPC)
@Component
public class SgyWsImpl implements SgyWs{

    @Override
    public String sayHi(){
        System.out.print("hi");
    };
}

最后启动服务即可,访问地址为http://localhost:8088/sgyws/sgyService

spring配置jax-ws

原文:https://www.cnblogs.com/yxth/p/8425995.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!