hey matt,
its not finished jet, i will work on it later again, i tried to implement
REST like this:
pom.xml:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxrs</artifactId>
<version>2.1.2</version>!!!!!!!!!!!!NOTICE THE PREVIOUS
VERSION!!!!!!!!!!!!
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-core</artifactId>
<version>2.1.3</version>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
<version>0.8</version>!!!!!!!!!!!!ACTUAL VERSION IS
1.0!!!!!!!!!!!!(missing methods and classes there ;( )
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>2.1.3</version>
</dependency>
the other thing i did is:
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import de.omq.model.ErrorModel;
@WebService
@Path("/errorservice/")
public interface ErrorManager extends GenericManager<ErrorModel, Long> {
public ErrorModel saveErrorModel(ErrorModel errorModel);
@GET
@Path("/errors/{title}")
List<ErrorModel> findByTitle(@PathParam("title") String title);
List<ErrorModel> findByDescription(String title);
List<ErrorModel> findByTitleAndDescription(String title,String
description);
}
--------------------and this in
cxf-servlet.xml---------------------------------------
<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: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/jaxrs
http://cxf.apache.org/schemas/jaxrs.xsd
http://cxf.apache.org/jaxws
http://cxf.apache.org/schemas/jaxws.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" />
<!-- #errorManager points to my manager(with the @webservice
annotation)
defined in my applicationContext.xml -->
<jaxws:endpoint
id="errorService"
implementor="#errorManager"
address="/ErrorService" >
</jaxws:endpoint>
<jaxrs:server id="errorService1" address="/ErrorService1">
<jaxrs:serviceBeans>
<ref bean="errorManager" />
</jaxrs:serviceBeans>
</jaxrs:server>
</beans>
most of it is from
http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html
----------------------------------
with this configuration jetty starts like this:
DEBUG [main] StartupListener.contextInitialized(38) | Initializing
context...
DEBUG [main] StartupListener.contextInitialized(82) | Remember Me Enabled?
true
DEBUG [main] StartupListener.contextInitialized(84) | Password Encoder:
org.springframework.security.providers.encoding.ShaPasswordEncoder
DEBUG [main] StartupListener.contextInitialized(86) | Populating
drop-downs...
DEBUG [main] LookupDaoHibernate.getRoles(20) | Retrieving all role names...
DEBUG [main] StartupListener.setupContext(102) | Drop-down initialization
complete [OK]
DEBUG [main] LocaleFilter.init(157) | Initializing filter 'localeFilter'
DEBUG [main] LocaleFilter.init(182) | Filter 'localeFilter' configured
successfully
Jan 7, 2009 12:12:37 PM org.apache.cxf.transport.servlet.CXFServlet
updateContext
INFO: Load the bus with application context
Jan 7, 2009 12:12:37 PM org.apache.cxf.bus.spring.BusApplicationContext
getConfigResources
INFO: No cxf.xml configuration file detected, relying on defaults.
Jan 7, 2009 12:12:37 PM org.apache.cxf.transport.servlet.AbstractCXFServlet
replaceDestinationFactory
INFO: Servlet transport factory already registered
Jan 7, 2009 12:12:37 PM org.apache.cxf.transport.servlet.CXFServlet
loadAdditionalConfig
INFO: Build endpoints from config-location: /WEB-INF/cxf-servlet.xml
Jan 7, 2009 12:12:38 PM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be /ErrorService
Jan 7, 2009 12:12:38 PM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be /ErrorService1
2009-01-07 12:12:38.204:/:INFO: Initializing Spring FrameworkServlet
'dispatcher'
2009-01-07 12:12:39.509::INFO: Started [email protected]:8080
[INFO] Started Jetty Server
[INFO] Starting scanner at interval of 3 seconds.
and other urls do:
http://localhost:8080/services/ErrorService1/
gives:
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><soap:Fault><faultcode>soap:Server</faultcode><faultstring>No
such operation: 1</faultstring></soap:Fault></soap:Body></soap:Envelope>
http://localhost:8080/services/ErrorService1/errors?title=sd
gives the same.
still working is the http://localhost:8080/services/ErrorService?wsdl by
responding:
<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="ErrorService"
targetNamespace="http://impl.service.omq.de/"
xmlns:ns1="http://service.omq.de/"
xmlns:ns2="http://cxf.apache.org/bindings/xformat"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://impl.service.omq.de/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:import
location="http://localhost:8080/services/ErrorService?wsdl=ErrorManager.wsdl"
namespace="http://service.omq.de/">
</wsdl:import>
<wsdl:message name="findByTitleResponse">
<wsdl:part element="ns1:findByTitleResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="findByTitleAndDescription">
<wsdl:part element="ns1:findByTitleAndDescription" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="findByTitleAndDescriptionResponse">
<wsdl:part element="ns1:findByTitleAndDescriptionResponse"
name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="findByDescriptionResponse">
<wsdl:part element="ns1:findByDescriptionResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="saveErrorModelResponse">
<wsdl:part element="ns1:saveErrorModelResponse" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="saveErrorModel">
<wsdl:part element="ns1:saveErrorModel" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="findByTitle">
<wsdl:part element="ns1:findByTitle" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:message name="findByDescription">
<wsdl:part element="ns1:findByDescription" name="parameters">
</wsdl:part>
</wsdl:message>
<wsdl:binding name="ErrorServiceSoapBinding" type="ns1:ErrorManager">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="findByDescription">
<soap:operation soapAction="" style="document" />
<wsdl:input name="findByDescription">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="findByDescriptionResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="findByTitle">
<soap:operation soapAction="" style="document" />
<wsdl:input name="findByTitle">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="findByTitleResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="saveErrorModel">
<soap:operation soapAction="" style="document" />
<wsdl:input name="saveErrorModel">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="saveErrorModelResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="findByTitleAndDescription">
<soap:operation soapAction="" style="document" />
<wsdl:input name="findByTitleAndDescription">
<soap:body use="literal" />
</wsdl:input>
<wsdl:output name="findByTitleAndDescriptionResponse">
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="ErrorService">
<wsdl:port binding="tns:ErrorServiceSoapBinding"
name="ErrorManagerImplPort">
<soap:address location="http://localhost:8080/services/ErrorService"
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
calling localhost/services gives me:
java.lang.NullPointerException
at
org.apache.cxf.service.model.EndpointInfo.getInterface(EndpointInfo.java:55)
at
org.apache.cxf.transport.servlet.ServletController.generateServiceList(ServletController.java:233)
at
org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:122)
at
org.apache.cxf.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:175)
at
org.apache.cxf.transport.servlet.AbstractCXFServlet.doGet(AbstractCXFServlet.java:157)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:487)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1093)
at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
at
com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:164)
at
org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
at
org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
at
org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:406)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
de.omq.webapp.filter.LocaleFilter.doFilterInternal(LocaleFilter.java:74)
at
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at
org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1084)
at
com.opensymphony.clickstream.ClickstreamFilter.doFilter(ClickstreamFilter.java:42)
at org.mortbay.jetty.servlet.ServletHandler$CachedChain.d
....
references:
http://cwiki.apache.org/CXF20DOC/jax-rs-jsr-311.html
https://jsr311.dev.java.net/
Nils Petersohn
snackycracky.wordpress.com
xing.com/profile/Nils_Petersohn
myspace.com/electrash
[email protected]
0049 (0)177 6311074
skype: nilz_berlin
icq: 99510895
Ebertystr. 47
10249 Berlin
--
View this message in context:
http://www.nabble.com/CXF-and-AppFuse-2.0.1-tp14282383s2369p21329504.html
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]