CXF 开发webService的步骤(java First)
发布日期:2021-11-04 22:04:02 浏览次数:4 分类:技术文章

本文共 578 字,大约阅读时间需要 1 分钟。

定义一个接口,用来定义提供服务。

写一个类实现上一步骤定义的接口。

在接口、接口实现类上添加注解@WebService

例子如下:

 a.定义接口

@WebService(name="quoteUpdater",   targetNamespace="http://cxf.apache.org", 

       wsdlLocation=  "http://somewhere.com/quoteExampleService?wsdl") 

publicinterfaceQuoteReporter{

     publicQuote getQuote(@WebParam(name="ticker") Stringticker);

}    

b.实现接口

@WebService(endpointInterface="org.apache.cxf.quoteReporter", 

      targetNamespace="http://cxf.apache.org",portName="StockQuotePort", 

      serviceName="StockQuoteReporter")

publicclass StockQuoteReporter implementsQuoteReporter{

      publicQuote getQuote(Stringticker)  { 

             ...  方法内容

      } 

}

转载地址:https://blog.csdn.net/xiaochangwei789/article/details/7703223 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister
下一篇:xfire使用注解的方式发布webService

发表评论

最新留言

留言是一种美德,欢迎回访!
[***.207.175.100]2024年04月08日 20时57分32秒