【发布时间】:2012-01-31 09:49:55
【问题描述】:
我使用 CXF 框架开发了 JAX-RS Web 服务,并部署在 Jboss6 中。 当我尝试使用我的 HTML 页面中的以下 URL http://localhost:8080/UPCServiceLayer/services/upcLineOfBusiness/create 访问应用程序时(仅使用 POST 方法),我在服务器控制台中收到以下错误
没有找到匹配请求路径/create的操作,
以下是我的cxf.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://cxf.apache.org/bindings/soap http://cxf.apache.org/schemas/configuration/soap.xsd
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
<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-extension-jaxrs-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
<import resource="classpath:../upc-spring-dao.xml" />
<jaxrs:server id="upcLineOfBusinessRestServiceServer" address="/upcLineOfBusiness">
<jaxrs:serviceBeans>
<ref bean="upcLineOfBusinessRestService" />
</jaxrs:serviceBeans>
</jaxrs:server>
<bean id="upcLineOfBusinessRestService"
class="com.tecnotree.upc.services.restservices.impl.UpcLineOfBusinessRestServiceImpl">
<property name="upcLineOfBusinessDao">
<ref bean="upcLineOfBusinessDao" />
</property>
<property name="upcUserDao">
<ref bean="upcUserDao" />
</property>
</bean>
</beans>
以下是我的资源类
@Path("/")
public classUpcLineOfBusinessRestService {
@POST
@ConsumeMime("application/xml")
@ProduceMime("application/xml")
@Path("/create")
public UpcLineOfBusinessEntity createUpcLineOfBusinessEntity(
UpcLineOfBusinessEntity upcLineOfBusinessEntity)
throws GenericUpcException
我还在我的 web.xml 文件中声明了 CXF servlet。
<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-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
请帮帮我
【问题讨论】:
标签: web-services rest cxf