2

I am trying to implement a simple web service provider using Tomcat6, CXF 2.2, Spring 3, and actually the service itself runs fine (I can call web methods using the original WSDL and SoapUI). However, Tomcat returns a blank page on "?wsdl" requests. Also, when I try to manipulate the (would-be) published WSDL by adding a publishedEndpointURL property to the jaxws:endpoint element, Tomcat will issue a XML parse exception (something like 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">

I used "contract first" style.

EDIT: What I did so far:

1.Setup tomcat6 with Spring3
2.Generate CXF implementation class by using maven
3.Provide web.xml (only relevant part shown)

    <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.Provide applicationContext.xml (only relevant part is shown)

<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.Package generated stuff into war and deploy

1 Answer 1

3

Turns out I wasn't seeing the WSDL because I was using Chrome. When viewed in Firefox, it displayed the WSDL.

Also, endpointURL worked when changed to endpointUrl (documentation error in CXF website).

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.