- 创建接口类:
@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 20:40:30 发布
本文介绍了一个关于WebService接口定义与实现过程中出现的ServiceConstructionException异常案例。该异常源于wsdl文件的targetNamespace与配置文件中tns属性值不一致。文章详细解释了如何创建WebService接口、实现接口、配置web.xml及bean,并生成wsdl文件。
1618

被折叠的 条评论
为什么被折叠?



