- 创建接口类:
@WebService(targetNamespace="http://service.sample.com/ws/") public interface Hello { @WebMethod public String sayHi(@WebParam(name="name") String name); }
- 实现接口 :
@WebService(endpointInterface = "Hello") public class HelloImpl implements Hello {...}
- 配置web.xml: 略
- 生成wsdl文件:
java2ws -o wsdl/hello.wsdl -wsdl Hello
- 配置bean:
<jaxws:endpoint id="hello" xmlns:tns="http://service.sample.com/ws/" implementor="HelloImpl" endpointName="tns:helloPort" serviceName="tns:helloService" wsdlLocation="classpath:wsdl/hello.wsdl" address="/hello" />
- 出现的异常:
我出现这种异常是wsdl文件的targetNamespace和配置的tns不一致导致。org.apache.cxf.service.factory.ServiceConstructionException: Could not find definition for service {
spring指定wsdl文件发布服务
最新推荐文章于 2024-07-01 15:56:32 发布