使用cxf开发web service 一下为配置文件
web.xml <!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Handles Spring requests -->
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
spring.xml<jaxws:endpoint id="testService" implementorClass="cn.com.softvan.ihotel.webservice.impl.TestServiceImpl" address="/testService" >
</jaxws:endpoint>
然后还有2个类 为接口TestService 和实现类TestServiceImpl。上面的org.springframework.web.servlet.DispatcherServlet是处理非web service的
org.apache.cxf.transport.servlet.CXFServlet 是处理web service的应用启动后,访问 http://localhost:8080/appname/services 显示No services have been found.
访问http://localhost:8080/appname/services/testService 报404 后台报错 Can't find the request for http://localhost:8080/iHotel/services/testService's Observer有人知道是怎么回事不? 另一个项目一样的配置 没有问题啊。纠结啊。求高人解答啊
web.xml <!-- Creates the Spring Container shared by all Servlets and Filters -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- Handles Spring requests -->
<servlet>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>
org.apache.cxf.transport.servlet.CXFServlet
</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>test</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
spring.xml<jaxws:endpoint id="testService" implementorClass="cn.com.softvan.ihotel.webservice.impl.TestServiceImpl" address="/testService" >
</jaxws:endpoint>
然后还有2个类 为接口TestService 和实现类TestServiceImpl。上面的org.springframework.web.servlet.DispatcherServlet是处理非web service的
org.apache.cxf.transport.servlet.CXFServlet 是处理web service的应用启动后,访问 http://localhost:8080/appname/services 显示No services have been found.
访问http://localhost:8080/appname/services/testService 报404 后台报错 Can't find the request for http://localhost:8080/iHotel/services/testService's Observer有人知道是怎么回事不? 另一个项目一样的配置 没有问题啊。纠结啊。求高人解答啊
解决方案 »
- 关于hibernate4
- byte类型转成doc文件保存
- 急聘网站开发人员,在线等
- jsp连接sqlserver 2000数据库时出现的这样的问题
- [Microsoft][ODBC 驱动程序管理器] 无效的游标状态 在线等
- Lucene如何搜索创建好的索引
- 在jsp中怎样判断一个文件夹中内容的大小?(这个文件夹中又包括文件和文件夹)
- JavaBean封装数据库打包后提示找不到!??
- 我的jsp和bean文件里都没有try{}catch{},为什么我的错误信息会出现'catch'without 'try'?
- 请高手指导 谢谢
- table平铺
- jsp中用<c:forEach items="empList" var="emp">遍历时怎么将${emp.Name}赋给
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>test</servlet-name>
<url-pattern>/test*</url-pattern>
</servlet-mapping>
~~~~问题依旧。不加/直接报错 Requested Resource Not Found
后台报错 Can't find the request for http://localhost:8080/iHotel/services/testService's Observer
public interface TestService { @WebMethod(operationName="test")
public String test(@WebParam(name = "xml") String xml);
}接口里的确有注解。appname是我自己改的 下面那个忘了改了。名字是一致的。
@WebService(endpointInterface = "××××.TestService")
实现类@WebService(endpointInterface = "cn.com.softvan.test.webservice.TestService", targetNamespace = "http://webservice.test.softvan.com.cn/")
public class TestServiceImpl implements TestService{ public String test(String xml) {
// TODO Auto-generated method stub
return "hello" + xml;
}}
http://gary0416.iteye.com/blog/1222915
Demo没问题。同样的配置在另一个项目上 也没问题,只有在这个项目上找不到服务~~~~。纠结啊。
spring 3.0.5
cxf 2.2.3
应该没有问题的啊