代码之家  ›  专栏  ›  技术社区  ›  Enno Shioji

如何让Tomcat为它提供的WS发布WSDL(CXF 2.2、Spring3、Tomcat6)

  •  0
  • Enno Shioji  · 技术社区  · 15 年前

    我尝试使用Tomcat6、CXF 2.2、Spring3实现一个简单的Web服务提供者,实际上服务本身运行良好(我可以使用原始的WSDL和SOAPUI调用Web方法)。但是,Tomcat在“”上返回一个空白页。WSDL“请求。另外,当我试图通过添加 publishedEndpointURL 属性到 jaxws:endpoint 元素,Tomcat将发出XML分析异常(类似于 property publishedEndpointURL is not allowed in element jaxws:endpoint )

     <jaxws:endpoint
                id="service"
                implementor="org.sample.ServiceImpl"
                implementorClass="org.sample.ServiceImpl"
                address="/service"
                publishedEndpointURL="http://localhost:8080/MyService/service">
    

    我用“合同第一”的方式。

    编辑: 到目前为止我所做的:

    1.用弹簧3设置Tomcat6
    2.使用maven生成cxf实现类
    3.提供web.xml(仅显示相关部分)

        <listener>
            <listener-class>org.springframework.web.context.ContextLoaderListener
            </listener-class>
        </listener>
    
        <servlet>
            <servlet-name>cxf</servlet-name>
            <servlet-class>
                org.apache.cxf.transport.servlet.CXFServlet
            </servlet-class>
            <load-on-startup>1</load-on-startup>
        </servlet>
    
        <servlet-mapping>
            <servlet-name>cxf</servlet-name>
            <url-pattern>/*</url-pattern>
        </servlet-mapping>
    </web-app> 
    

    4.提供applicationContext.xml(仅显示相关部分)

    <import resource="classpath:META-INF/cxf/cxf.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
    
    <jaxws:endpoint
            id="service"
            implementor="org.sample.ServiceImpl"
            implementorClass="org.sample.ServiceImpl"
            address="/service"/>
    

    5.将生成的东西打包到战争中部署

    1 回复  |  直到 14 年前
        1
  •  1
  •   Enno Shioji    15 年前

    结果我不是 看到 WSDL,因为我使用的是Chrome。在Firefox中查看时,它显示WSDL。

    另外,当更改为endpointurl(cxf网站中的文档错误)时,endpointurl也起作用。