本文共 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 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!