Reputation: 682
this is the situation: we have a Spring-MVC application that should now provide a contract-first SOAP webservice. After looking at a CXF example (wsdl_first), I finally managed to get this far:
I generated the skeleton classes and also implemented the service interface.
Tomcat 7 seems to deploy something:
12 Jan 2014 19:32:08,386 INFO org.apache.cxf.service.factory.ReflectionServiceFactoryBean:411 - Creating Service {urn:webservice.x.com:wsdl}IdmAdapterService from WSDL: classpath:IdmAdapterService.wsdl
I created a second servlet which should handle the webservice calls. WEB-INF/web.xml contains:
<servlet>
<servlet-name>webservices</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>webservices</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
WEB-INF/cxf-servlet.xml contains:
<jaxws:endpoint xmlns:tns="urn:webservice.x.com:wsdl"
id="idmAdapterImpl" address="/services/IdmAdapterService"
serviceName="tns:IdmAdapterService" endpointName="tns:IdmAdapterSoapPort"
implementor="de.y.idm.IdmAdapterImpl"
/>
src/main/resources/cxf.xml contains:
<jaxws:endpoint name="{urn:webservice.x.com:wsdl}:IdmAdapterSoapPort"
wsdlLocation="IdmAdapterService.wsdl">
<jaxws:properties>
<entry key="schema-validation-enabled" value="true" />
</jaxws:properties>
</jaxws:endpoint>
src/main/resources/server-applicationContext.xml contains:
<!-- HTTP Endpoint -->
<jaxws:endpoint xmlns:tns="urn:webservice.x.com:wsdl"
id="idmAdapterImpl"
address="/services/IdmAdapterService"
serviceName="tns:IdmAdapterService"
endpointName="tns:IdmAdapterSoapPort"
implementor="de.y.idm.IdmAdapterImpl">
<jaxws:features>
<bean class="org.apache.cxf.feature.LoggingFeature" />
</jaxws:features>
</jaxws:endpoint>
When I call the URL
http://localhost:8080/application/services/IdmAdaptorService?wsdl
I always end up with
No service was found.
and on the console
12 Jan 2014 19:51:53,731 DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter:136 - Opening JPA EntityManager in OpenEntityManagerInViewFilter
12 Jan 2014 19:51:53,732 DEBUG org.springframework.security.util.FilterChainProxy:205 - Converted URL to lowercase, from: '/services/idmadapterservice'; to: '/services/idmadapterservice'
12 Jan 2014 19:51:53,732 DEBUG org.springframework.security.util.FilterChainProxy:212 - Candidate is: '/services/idmadapterservice'; pattern is /services/**; matched=true
12 Jan 2014 19:51:53,733 DEBUG org.springframework.security.util.FilterChainProxy:165 - has an empty filter list
12 Jan 2014 19:51:53,733 WARN org.apache.cxf.transport.servlet.ServletController:175 - Can't find the the request for http://localhost:8080/application/services/IdmAdapterService's Observer
12 Jan 2014 19:51:53,734 DEBUG org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter:154 - Closing JPA EntityManager in OpenEntityManagerInViewFilter
12 Jan 2014 19:51:53,734 DEBUG org.springframework.orm.jpa.EntityManagerFactoryUtils:338 - Closing JPA EntityManager
What am I missing, what might be the problem?
Thanks in advance.
Upvotes: 2
Views: 13362
Reputation: 49935
the /services/IdmAdapterService
in server-applicationContext.xml
is relative to the servlet-mapping of CXFServlet
which is /services/*
. So your actual path of the service should be:
http://localhost:8080/application/services/services/IdmAdapterService
Upvotes: 7