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一多,地址不好規范 ,但測試很方便 隨便設地址


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM