act*_*ctc 2 java spring wsdl web-services cxf
情况就是这样:我们有一个Spring-MVC应用程序,现在应该提供契约优先的SOAP Web服务.在查看了一个CXF示例(wsdl_first)之后,我终于成功了:
我生成了骨架类,并且还实现了服务接口.
Tomcat 7似乎部署了一些东西:
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
Run Code Online (Sandbox Code Playgroud)
我创建了第二个应该处理webservice调用的servlet.WEB-INF/web.xml包含:
<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>
Run Code Online (Sandbox Code Playgroud)
WEB-INF/cxf-servlet.xml包含:
<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"
/>
Run Code Online (Sandbox Code Playgroud)
src/main/resources/cxf.xml包含:
<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>
Run Code Online (Sandbox Code Playgroud)
src/main/resources/server-applicationContext.xml包含:
<!-- 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>
Run Code Online (Sandbox Code Playgroud)
当我调用URL时
http://localhost:8080/application/services/IdmAdaptorService?wsdl
Run Code Online (Sandbox Code Playgroud)
我总是最终得到
No service was found.
Run Code Online (Sandbox Code Playgroud)
并在控制台上
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
Run Code Online (Sandbox Code Playgroud)
我错过了什么,可能是什么问题?
提前致谢.
的/services/IdmAdapterService在server-applicationContext.xml相对于该Servlet映射的CXFServlet是/services/*.所以你的实际服务路径应该是:
http://localhost:8080/application/services/services/IdmAdapterService
| 归档时间: |
|
| 查看次数: |
11702 次 |
| 最近记录: |