webservice中jaxws:server 和jaxws:endpoint的区别

今天在学习使用spring+cxf发布webservice时遇到个问题,我原来是用

<jaxws:endpoint id="helloWorld"         implementor="org.andy.cxf.HelloWorldImpl"
    address="/HelloWorld" />

来发布的,但是有个问题,是方法发布不上去,调用的时候会报错,原因是我的两个文件不在同一级目录下 
这里写图片描述 
将impl移到上面来就可以了 
这里写图片描述 
但是这样做的话不够规范,为什么要这样做我也不明白,所以我换了一种发布的方法-jaxws:server,换了之后按照图一的写法可以正确的发布webservice,现在把代码贴出来

 <!--    这是实现类 -->
    <bean id="HelloWorldImpl"    class="org.andy.cxf.impl.HelloWorldImpl" />
    <!-- org.andy.cxf.HelloWorld 是接口的路径-->
    <jaxws:server serviceClass="org.andy.cxf.HelloWorld"
        address="/HelloWorld">
        <jaxws:serviceBean>
            <ref bean="HelloWorldImpl" />
        </jaxws:serviceBean>
    </jaxws:server>

至于两者的区别,我百度了下答案如下:

1、endpoint是java提供的方法,server是cxf提供的

2、访问wsdl地址设置不同 endpoint可以直接设,server这要根据你的项目及cxf.xml决定

3、endpoint不推荐用,具体的话估计是wsdl一多,地址不好规范 ,但测试很方便 随便设地址

原文地址:https://www.cnblogs.com/laoyeye/p/6518299.html