【问题标题】:WSDL not displayed using CXF framework未使用 CXF 框架显示 WSDL
【发布时间】:2016-10-30 12:15:54
【问题描述】:

我正在使用 CXF 框架开发一个 SOAP 网络服务。我做了必须做的事情,但问题是当我从导航器调用 WSDL 时,我看不到它。

这些是我的配置

pom.xml

    <!-- CXF -->
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxws</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-transports-http</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.cxf</groupId>
        <artifactId>cxf-rt-frontend-jaxrs</artifactId>
        <version>3.0.0</version>
    </dependency>

这是我的配置文件

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:jaxws="http://cxf.apache.org/jaxws"
        xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
    
        <jaxws:endpoint implementor="ma.none.net.ws.TestWebService"
            id="helloWorldService" address="/helloTest"></jaxws:endpoint>
    
    </beans>

这是我的网络服务

    package ma.none.net.ws;
    
    import javax.jws.WebService;
    
    import ma.none.net.iws.ITestWebService;
    
    @WebService(endpointInterface = "ma.none.net.iws.ITestWebService", serviceName = "helloWorldService")
    public class TestWebService implements ITestWebService {
    
        @Override
        public String helloEveryOne(String name) {
            return "Hi every One, including you "+name;
        }
    }

这些是输出

这就是我要求 wsdl 时得到的结果

响应是 200.OK,我可以看到 wsdl,但我不知道为什么我无法在导航器中获得 wsdl,但我怀疑我不知道这个问题与缺少的 jar 有关。

感谢您的建议。

【问题讨论】:

  • 不,mozila 导航器。

标签: java web-services soap wsdl cxf


【解决方案1】:

也许你需要在你的方法helloEveryOne上注解@WebMethod

接下来,调用你的web服务的操作helloEveryOne,你可以试试:

localhost:8080/net/webservices/helloTest/helloEveryOne?name=wsdl

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-26
    • 1970-01-01
    • 2019-01-31
    • 1970-01-01
    • 2011-06-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多