Problem with JAX-RS services in the last CXF snapshot.

2008-04-04 Thread Vincenzo Vitale
Hi,

I'm trying to integrate the JAX-RS implementation now included in CXF 2.1
(snapshot).

The service is correctly called and the parameters arrive fine but then I
get a page with the message:

No message body writer found for response class : SimpleResponse.

Where SimpleResponse is my custom response bean extending the
javax.ws.rs.core.Response.

Here the code:

@Path(/ButtonService)
public class ButtonWebServiceImpl implements ButtonWebService {


@Path(/addressButton/{action}/{apiKey}/{countryCode}/{state}/{city}/
+
{street}/{number}/{postCode}/{attribution}/{logoUrl}/{name}/{description}/{source}/{buttonServer}/{buttonArtUrl})
@GET
public SimpleResponse createForAddress(@PathParam(value = action)
String action, @PathParam(value = apiKey)
String apiKey, @PathParam(value = countryCode)
String countryCode, @PathParam(value = state)
String state, @PathParam(value = city)
String city, @PathParam(value = street)
String street, @PathParam(value = number)
String number, @PathParam(value = postCode)
String postCode, @PathParam(value = attribution)
String attribution, @PathParam(value = logoUrl)
String logoUrl, @PathParam(value = name)
String name, @PathParam(value = description)
String description, @PathParam(value = source)
String source, @PathParam(value = buttonServer)
String buttonServer, @PathParam(value = buttonArtUrl)
String buttonArtUrl) {
...
}
}

and in Spring:

jaxrs:server id=buttonWebServiceRest
address=/rest/
jaxrs:serviceBeans
ref bean=buttonWebServiceImpl /
/jaxrs:serviceBeans
/jaxrs:server


Have any glue on that?


Further questions:

- My SimpleResponse extend the javax Response as I red in the JAXRS new
documentation that this is a requirement for the HTTPMerthod annotation. Is
this valid also for the @GET annotation? How I have to implement it?

- Before the JAXRS implementation I always used to put the annotations at
the interface level but now in this way it doesn't seem to work anymore. I'm
missing something to make it possible? Maybe is this a JAXRS specification?




Thanks in advance,
Vicio.


Re: Problem with JAX-RS services in the last CXF snapshot.

2008-04-04 Thread Vincenzo Vitale
Looking at the CXF code it seems the problem is here:

private T MessageBodyWriterT chooseMessageWriter(
ListMessageBodyWriter writers, ClassT type, MediaType mediaType)
{
for (MessageBodyWriterT ep : writers) {
if (!ep.isWriteable(type)) {
continue;
}

where [EMAIL PROTECTED],
[EMAIL PROTECTED],
[EMAIL PROTECTED],
[EMAIL PROTECTED],
[EMAIL PROTECTED],
[EMAIL PROTECTED],
[EMAIL PROTECTED]

these are the writers and my class seems not be registered with this
writers. Maybe there is a way to make it possible for a writer to have my
class in output... but I'm just guessing... :-)

I will try your solution..


Thnaks,
V.

On Fri, Apr 4, 2008 at 4:51 PM, Sergey Beryozkin [EMAIL PROTECTED]
wrote:

 Hi

 I think you need to return a Response and then in your code do :

 return Response.setEntity(yourObject).build()

 I think that just by the virtue of extending a Response you can not have
 it serialized.


  - Before the JAXRS implementation I always used to put the annotations
 at
  the interface level but now in this way it doesn't seem to work anymore.
 I'm
  missing something to make it possible? Maybe is this a JAXRS
 specification?

 I've seen on a Jersey list recently that it's a feature of the 0.7 API
 (spec), we're at a 0.6 level currently...
 and that annotations will only be supported at a method level, don't know
 more about it at this stage

 Hope it helps, Sergey



  Hi,
 
  I'm trying to integrate the JAX-RS implementation now included in CXF
 2.1
  (snapshot).
 
  The service is correctly called and the parameters arrive fine but then
 I
  get a page with the message:
 
  No message body writer found for response class : SimpleResponse.
 
  Where SimpleResponse is my custom response bean extending the
  javax.ws.rs.core.Response.
 
  Here the code:
 
  @Path(/ButtonService)
  public class ButtonWebServiceImpl implements ButtonWebService {
 
 
 
  @Path(/addressButton/{action}/{apiKey}/{countryCode}/{state}/{city}/
 +
 
 {street}/{number}/{postCode}/{attribution}/{logoUrl}/{name}/{description}/{source}/{buttonServer}/{buttonArtUrl})
 @GET
 public SimpleResponse createForAddress(@PathParam(value = action)
 String action, @PathParam(value = apiKey)
 String apiKey, @PathParam(value = countryCode)
 String countryCode, @PathParam(value = state)
 String state, @PathParam(value = city)
 String city, @PathParam(value = street)
 String street, @PathParam(value = number)
 String number, @PathParam(value = postCode)
 String postCode, @PathParam(value = attribution)
 String attribution, @PathParam(value = logoUrl)
 String logoUrl, @PathParam(value = name)
 String name, @PathParam(value = description)
 String description, @PathParam(value = source)
 String source, @PathParam(value = buttonServer)
 String buttonServer, @PathParam(value = buttonArtUrl)
 String buttonArtUrl) {
  ...
 }
  }
 
  and in Spring:
 
 jaxrs:server id=buttonWebServiceRest
 address=/rest/
 jaxrs:serviceBeans
 ref bean=buttonWebServiceImpl /
 /jaxrs:serviceBeans
 /jaxrs:server
 
 
  Have any glue on that?
 
 
  Further questions:
 
  - My SimpleResponse extend the javax Response as I red in the JAXRS new
  documentation that this is a requirement for the HTTPMerthod annotation.
 Is
  this valid also for the @GET annotation? How I have to implement it?
 
  - Before the JAXRS implementation I always used to put the annotations
 at
  the interface level but now in this way it doesn't seem to work anymore.
 I'm
  missing something to make it possible? Maybe is this a JAXRS
 specification?
 
 
 
 
  Thanks in advance,
  Vicio.
 

 
 IONA Technologies PLC (registered in Ireland)
 Registered Number: 171387
 Registered Address: The IONA Building, Shelbourne Road, Dublin 4, Ireland



Re: Problem with JAX-RS services in the last CXF snapshot.

2008-04-04 Thread Vincenzo Vitale
It worked! :-)

So now I'm just returning:

return Response.ok(simpleResponse).build();

where the SimpleResponse class has the @XmlRootElement annotation on top.


Thank you very much for your help,
V.


On Fri, Apr 4, 2008 at 5:51 PM, Beryozkin, Sergey [EMAIL PROTECTED]
wrote:

 Hi

 MessageBodyWriter.isWriteable() checks if a given type can be
 serialized, so if say you custom type has no JAXB annotations then no
 matching writer will be found. You may want just to add @XmlRootElement
 to the root of your class, alternatively you can register your custom
 writer. Please check the JAXRS system tests on how this can be
 done...(I'm sorry, at the moment that's our documentation :-)).

 Typically You don't need to extend a Response, Response is a convenience
 holder for a status, the entity and response headers

 Cheers, Sergey

 -Original Message-
 From: Vincenzo Vitale [mailto:[EMAIL PROTECTED]
 Sent: 04 April 2008 16:28
 To: cxf-user@incubator.apache.org
 Subject: Re: Problem with JAX-RS services in the last CXF snapshot.

 Looking at the CXF code it seems the problem is here:

 private T MessageBodyWriterT chooseMessageWriter(
ListMessageBodyWriter writers, ClassT type, MediaType
 mediaType)
 {
for (MessageBodyWriterT ep : writers) {
if (!ep.isWriteable(type)) {
continue;
}

 where [EMAIL PROTECTED],
 [EMAIL PROTECTED],
 [EMAIL PROTECTED],
 [EMAIL PROTECTED],
 [EMAIL PROTECTED],
 [EMAIL PROTECTED],
 [EMAIL PROTECTED]

 these are the writers and my class seems not be registered with this
 writers. Maybe there is a way to make it possible for a writer to have
 my
 class in output... but I'm just guessing... :-)

 I will try your solution..


 Thnaks,
 V.

 On Fri, Apr 4, 2008 at 4:51 PM, Sergey Beryozkin
 [EMAIL PROTECTED]
 wrote:

  Hi
 
  I think you need to return a Response and then in your code do :
 
  return Response.setEntity(yourObject).build()
 
  I think that just by the virtue of extending a Response you can not
 have
  it serialized.
 
 
   - Before the JAXRS implementation I always used to put the
 annotations
  at
   the interface level but now in this way it doesn't seem to work
 anymore.
  I'm
   missing something to make it possible? Maybe is this a JAXRS
  specification?
 
  I've seen on a Jersey list recently that it's a feature of the 0.7 API
  (spec), we're at a 0.6 level currently...
  and that annotations will only be supported at a method level, don't
 know
  more about it at this stage
 
  Hope it helps, Sergey
 
 
 
   Hi,
  
   I'm trying to integrate the JAX-RS implementation now included in
 CXF
  2.1
   (snapshot).
  
   The service is correctly called and the parameters arrive fine but
 then
  I
   get a page with the message:
  
   No message body writer found for response class : SimpleResponse.
  
   Where SimpleResponse is my custom response bean extending the
   javax.ws.rs.core.Response.
  
   Here the code:
  
   @Path(/ButtonService)
   public class ButtonWebServiceImpl implements ButtonWebService {
  
  
  
 
 @Path(/addressButton/{action}/{apiKey}/{countryCode}/{state}/{city}/
  +
  
 
 {street}/{number}/{postCode}/{attribution}/{logoUrl}/{name}/{descriptio
 n}/{source}/{buttonServer}/{buttonArtUrl})
  @GET
  public SimpleResponse createForAddress(@PathParam(value =
 action)
  String action, @PathParam(value = apiKey)
  String apiKey, @PathParam(value = countryCode)
  String countryCode, @PathParam(value = state)
  String state, @PathParam(value = city)
  String city, @PathParam(value = street)
  String street, @PathParam(value = number)
  String number, @PathParam(value = postCode)
  String postCode, @PathParam(value = attribution)
  String attribution, @PathParam(value = logoUrl)
  String logoUrl, @PathParam(value = name)
  String name, @PathParam(value = description)
  String description, @PathParam(value = source)
  String source, @PathParam(value = buttonServer)
  String buttonServer, @PathParam(value = buttonArtUrl)
  String buttonArtUrl) {
   ...
  }
   }
  
   and in Spring:
  
  jaxrs:server id=buttonWebServiceRest
  address=/rest/
  jaxrs:serviceBeans
  ref bean=buttonWebServiceImpl /
  /jaxrs:serviceBeans
  /jaxrs:server
  
  
   Have any glue on that?
  
  
   Further questions:
  
   - My SimpleResponse extend the javax Response as I red in the JAXRS
 new
   documentation that this is a requirement for the HTTPMerthod
 annotation.
  Is
   this valid also for the @GET annotation? How I have to implement it?
  
   - Before the JAXRS implementation I always used to put the
 annotations
  at
   the interface level but now in this way it doesn't seem to work
 anymore.
  I'm
   missing something to make it possible? Maybe is this a JAXRS
  specification?
  
  
  
  
   Thanks in advance,
   Vicio.
  
 
  
  IONA Technologies PLC (registered

Re: Url parameters in rest web services

2007-10-05 Thread Vincenzo Vitale
Problem solved. In my development environment I was using the port number
(so without using Apache) but to call the web service in the test
environment I omitted the port number and the URL was decoded two times.

So now I only need to understand how to avoid this behaviour also when the
port is not used but this is out of the cxf mailing list.


Ciao,
V.



On 10/4/07, Vincenzo Vitale [EMAIL PROTECTED] wrote:

 Hi,

 I developed some web services using the HttpResource annotation.

 So for example I have the annotation:

 @HttpResource(location =
 /myService/{firstParameter}/{secondParameter}/{urlParameter}/{lastParameter})


 The problem has that my parameters can contain url and I solved the
 problems with for example something like http://;, double encoding it in
 http%253A%252F%252F.

 In my development environment (Jboss under Windows) the method gets the
 single encoded version http%3A%2F%2F and that's fine. But in the test
 environment under linux the parameter in the URL is decoded twice and
 actually the / in the URL is interpreted by cxf like a parameter separator.

 Any suggestion on what can cause this? Maybe a Jboss or locale
 configuration I need to change. I'm also wondering if it's possible to use
 normal parameters in a rest service exposed with cxf instead of url
 template. there is the queryParameter attribute in the @HttpResource but I
 have not found any example on how to use it.


 Thanks,
 Vincenzo.





Re: Rest services response into ![CDATA[ boundaries.

2007-10-04 Thread Vincenzo Vitale
Thank you very much Dan,

I'm not an AOP expert but I will try to do it and let you know.


Ciao,
V.

On 10/3/07, Daniel Kulp [EMAIL PROTECTED] wrote:


 it's definitely not something that falls into the simple to implement
 ball park.

 One option that comes to mind is to write an interceptor that sits
 immediately AFTER the StaxOutInterceptor and wrappers the
 XmlStreamWriter with a new XmlStreamWriter that forwards the
 writeCharacters calls to writeCDATA instead.   That would make all the
 strings CDATA sections.   You could probably analyze the string a bit
 first.   That probably wouldn't be too hard to do.

 Dan


 On Wednesday 03 October 2007, Vincenzo Vitale wrote:
  No one with the same requirement? :-(
 
  I know that with normal XML parsers having a CDATA section or an
  escaped one should not be a problem but in my case maybe the third
  party are soing to use a custom old style parser... I'm thing about
  creating a servlet filter to substitute the output in the rest case
  but it seems to me really really old style!
 
 
  Ciao,
  V.
 
  On 9/28/07, Vincenzo Vitale [EMAIL PROTECTED] wrote:
   Hi All,
  
   I'm exposing a rest services (using annotation) and the return value
   is a string with html code inside. The result value is escaped but I
   would like to have it between ![CDATA[, like it's done with the
   equivalent Soap service.
  
   Is it possible?
  
  
   Thanks,
   Vincenzo.



 --
 J. Daniel Kulp
 Principal Engineer
 IONA
 P: 781-902-8727C: 508-380-7194
 [EMAIL PROTECTED]
 http://www.dankulp.com/blog



Url parameters in rest web services

2007-10-04 Thread Vincenzo Vitale
Hi,

I developed some web services using the HttpResource annotation.

So for example I have the annotation:

@HttpResource(location =
/myService/{firstParameter}/{secondParameter}/{urlParameter}/{lastParameter})


The problem has that my parameters can contain url and I solved the problems
with for example something like http://;, double encoding it in
http%253A%252F%252F.

In my development environment (Jboss under Windows) the method gets the
single encoded version http%3A%2F%2F and that's fine. But in the test
environment under linux the parameter in the URL is decoded twice and
actually the / in the URL is interpreted by cxf like a parameter separator.

Any suggestion on what can cause this? Maybe a Jboss or locale configuration
I need to change. I'm also wondering if it's possible to use normal
parameters in a rest service exposed with cxf instead of url template. there
is the queryParameter attribute in the @HttpResource but I have not found
any example on how to use it.


Thanks,
Vincenzo.


Re: Rest services response into ![CDATA[ boundaries.

2007-10-03 Thread Vincenzo Vitale
No one with the same requirement? :-(

I know that with normal XML parsers having a CDATA section or an escaped one
should not be a problem but in my case maybe the third party are soing to
use a custom old style parser... I'm thing about creating a servlet filter
to substitute the output in the rest case but it seems to me really really
old style!


Ciao,
V.

On 9/28/07, Vincenzo Vitale [EMAIL PROTECTED] wrote:

 Hi All,

 I'm exposing a rest services (using annotation) and the return value is a
 string with html code inside. The result value is escaped but I would like
 to have it between ![CDATA[, like it's done with the equivalent Soap
 service.

 Is it possible?


 Thanks,
 Vincenzo.



Rest services response into ![CDATA[ boundaries.

2007-09-28 Thread Vincenzo Vitale
Hi All,

I'm exposing a rest services (using annotation) and the return value is a
string with html code inside. The result value is escaped but I would like
to have it between ![CDATA[, like it's done with the equivalent Soap
service.

Is it possible?


Thanks,
Vincenzo.


Re: CXFServlet + WebServices + Spring MVC

2007-09-24 Thread Vincenzo Vitale
I have just tried to use the snapshot version (2.1-incubator-SNAPSHOT) and
it worked nice, so I assume it was a bug.

In my company (www.tomtom.com) we cannot release projects (we use the maven
release plugin) with snapshot dependencies and it would be really a shame to
renounce at cxf for this... and also I don't want to write a Spring mvc
controller for my rest services :-(

Would it be possible to make available a no snapshot release with this
problem solved?


Thanks,
Vincenzo Vitale.

On 9/24/07, vicio [EMAIL PROTECTED] wrote:


 Hello,

 have you solveed the problem.


 I have a simila r use  case. My methos is:

 @WebMethod(operationName = getKey, action = account:GetKey,
 exclude
 = false)
 @Get
 @HttpResource(location = /keys/{federatedAccountId}/{domainName})
 SimpleResponse getKey(@WebParam(name = federatedAccountId)
 String federatedAccountId, @WebParam(name = domainName)
 String domainName);

 and in Spring:

 jaxws:endpoint id=accountWebServiceSoap
 implementor=#accountWebServiceImpl
 address=/soap/AccountService /

 jaxws:endpoint id=accountWebServiceRest
 implementor=#accountWebServiceImpl
 address=/rest/AccountService
 bindingUri=http://apache.org/cxf/binding/http;
 jaxws:serviceFactory
 bean
 class=
 org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
 property name=wrapped value=true /
 /bean
 /jaxws:serviceFactory
 /jaxws:endpoint


 but when I try to call the rest url
 (http://localhost:8080/ws/rest/AccountService/keys/34/myDomain) the two
 parameters are not set (null value).


 Any suggestions?

 Thanks,
 V.

 RayKrueger wrote:
 
  If you search back you'll see I worked through some similar
  discussions in this area...
 
  I wanted to write one endpoint that could handle SOAP, POX and REST.
  With some help I was able to get the SOAP and POX stuff working great,
  REST however never seemed to set the properties, I haven't spent much
  time looking at that part though...
 
  Basically we have a very heavily annotated endpoint interface and impl
  declared in our ApplicationContext like this...
 
  ?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;
 xsi:schemaLocation=
http://www.springframework.org/schema/beans
  http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://cxf.apache.org/jaxws
 http://cxf.apache.org/schemas/jaxws.xsd;
 
  jaxws:endpoint id=soapCurrencyExchange
  implementor=#currencyExchangeImpl
  bindingUri=http://schemas.xmlsoap.org/soap/;
  address=/CurrencyExchange.soap/
 
  jaxws:endpoint id=xmlCurrencyExchange
  implementor=#currencyExchangeImpl
  bindingUri=http://cxf.apache.org/bindings/xformat;
  address=/CurrencyExchange.xml/
 
  jaxws:endpoint id=restCurrencyExchange
  implementor=#currencyExchangeImpl
  bindingUri=http://apache.org/cxf/binding/http;
  address=/CurrencyExchange
  jaxws:serviceFactory
  bean
  class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
  property name=wrapped value=true/
  /bean
  /jaxws:serviceFactory
  /jaxws:endpoint
 
  /beans
 
  My endpoint interface defines one method
  getExchangeRate(ExchangeRateRequest). As I said, the SOAP and POX
  mappings worked fine, but I never got REST to work. The method would
  be invoked by the properties I had defined in the @HttpResource
  annotation would never be set on the ExchangeRateRequest object.
 
  So when I'd annotated it as...
  @HttpResource(location=/rates/{fromCurrency},{toCurrency})
  getExchangeRate(ExchangeRateRequest request)
 
  ...I'd end up with nulls when I called request.getFromCurrency and
  getToCurrency. Again, the method was invoked, the ExchangeRateRequest
  object was instantiated, but the properties never got set. Maybe it
  can't be a JAXB generated class or something...
  On 9/21/07, mattmadhavan [EMAIL PROTECTED] wrote:
 
  Hello,
  I am currently working on a project for my current client for all
  external
  notifications. My requirements are as follows:
   * Some of my client's partners communicate via Straight HTTP Post -
 Data
  can be HTTP (I guess I can use REST for this - but not all of them send
  XML!)
  * Some do via SOAP.
 
  This is for a premiums and thats how my client makes his money and I
  would
  like to give them a robust solution.
 
  I would like to use CXF Servlet (Or straight Spring Dispatcher
  Servelt)and
  also add Spring MVC controller so that I can add

Re: CXFServlet + WebServices + Spring MVC

2007-09-24 Thread Vincenzo Vitale
Great, it works :-)


Thank you very much,
V.

On 9/24/07, Daniel Kulp [EMAIL PROTECTED] wrote:



 Vincenzo,

 We're currently voting on 2.0.2 which should hopefully be released
 tomorrow afternoon.   You can grab the release candidates from:
 http://people.apache.org/~dkulp/stage_cxf/2.0.2-incubator-take2/

 I'm note sure what the specific bug was that you're encountering, but it
 MAY be fixed in that build.

 Dan



 On Monday 24 September 2007, Vincenzo Vitale wrote:
  I have just tried to use the snapshot version (2.1-incubator-SNAPSHOT)
  and it worked nice, so I assume it was a bug.
 
  In my company (www.tomtom.com) we cannot release projects (we use the
  maven release plugin) with snapshot dependencies and it would be
  really a shame to renounce at cxf for this... and also I don't want to
  write a Spring mvc controller for my rest services :-(
 
  Would it be possible to make available a no snapshot release with this
  problem solved?
 
 
  Thanks,
  Vincenzo Vitale.
 
  On 9/24/07, vicio [EMAIL PROTECTED] wrote:
   Hello,
  
   have you solveed the problem.
  
  
   I have a simila r use  case. My methos is:
  
   @WebMethod(operationName = getKey, action = account:GetKey,
   exclude
   = false)
   @Get
   @HttpResource(location =
   /keys/{federatedAccountId}/{domainName}) SimpleResponse
   getKey(@WebParam(name = federatedAccountId) String
   federatedAccountId, @WebParam(name = domainName) String
   domainName);
  
   and in Spring:
  
   jaxws:endpoint id=accountWebServiceSoap
   implementor=#accountWebServiceImpl
   address=/soap/AccountService /
  
   jaxws:endpoint id=accountWebServiceRest
   implementor=#accountWebServiceImpl
   address=/rest/AccountService
   bindingUri=http://apache.org/cxf/binding/http;
   jaxws:serviceFactory
   bean
   class=
   org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
   property name=wrapped
   value=true / /bean
   /jaxws:serviceFactory
   /jaxws:endpoint
  
  
   but when I try to call the rest url
   (http://localhost:8080/ws/rest/AccountService/keys/34/myDomain) the
   two parameters are not set (null value).
  
  
   Any suggestions?
  
   Thanks,
   V.
  
   RayKrueger wrote:
If you search back you'll see I worked through some similar
discussions in this area...
   
I wanted to write one endpoint that could handle SOAP, POX and
REST. With some help I was able to get the SOAP and POX stuff
working great, REST however never seemed to set the properties, I
haven't spent much time looking at that part though...
   
Basically we have a very heavily annotated endpoint interface and
impl declared in our ApplicationContext like this...
   
?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;
   xsi:schemaLocation=
  http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  http://cxf.apache.org/jaxws
  
   http://cxf.apache.org/schemas/jaxws.xsd;
  
jaxws:endpoint id=soapCurrencyExchange
implementor=#currencyExchangeImpl
bindingUri=http://schemas.xmlsoap.org/soap/;
address=/CurrencyExchange.soap/
   
jaxws:endpoint id=xmlCurrencyExchange
implementor=#currencyExchangeImpl
   
bindingUri=http://cxf.apache.org/bindings/xformat;
address=/CurrencyExchange.xml/
   
jaxws:endpoint id=restCurrencyExchange
implementor=#currencyExchangeImpl
   
bindingUri=http://apache.org/cxf/binding/http;
address=/CurrencyExchange
jaxws:serviceFactory
bean
class=org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean
property name=wrapped value=true/
/bean
/jaxws:serviceFactory
/jaxws:endpoint
   
/beans
   
My endpoint interface defines one method
getExchangeRate(ExchangeRateRequest). As I said, the SOAP and
POX mappings worked fine, but I never got REST to work. The method
would be invoked by the properties I had defined in the
@HttpResource annotation would never be set on the
ExchangeRateRequest object.
   
So when I'd annotated it as...
@HttpResource(location=/rates/{fromCurrency},{toCurrency})
getExchangeRate(ExchangeRateRequest request)
   
...I'd end up with nulls when I called request.getFromCurrency and
getToCurrency. Again, the method was invoked, the
ExchangeRateRequest object was instantiated, but the properties
never got set. Maybe it can't be a JAXB generated class or
something

Re: Automatic Testing CXF Web Services out of the box

2007-09-14 Thread Vincenzo Vitale
For the service API I have written Junit unit testing using EasyMock.

I would like to test the webservice deployed and running to check it works
as expected without problems. (Runtime exceptions for example).

On 9/14/07, Dale Peakall [EMAIL PROTECTED] wrote:

 It depends what you're trying to test: the network interface, or the
 service API.  There's no need to create (or use) the network interface
 if what you actually want to test is the service API.

 Vincenzo Vitale wrote:
  Hi,
 
  I would like to automatic testing my web services out of the box, that
 is
  integrated in an application server I can start in a JUnit test case.
 
  My idea is using Jetty to launch the application I'm writing and then
 call
  the webservice with a dynamic client configured with Spring (extending
  AbstractDependencyInjectionSpringContextTests). BTW I don't like this
  approach (launching a web server cannot be permitted in some environment
 and
  also the port must not be used), moreover I also need to think how to
 create
  a mock data provider.
 
  There is a better way to do it?
 
 
  Thanks,
  Vicio.
 
 




Re: Hibernate and cxf 2.01 problem.

2007-09-13 Thread Vincenzo Vitale
Thanks Juan, this solved the problem with the 2.0.1-incubator version.

Now my cxf dependencies are:

!--
Web Services framework.
--
dependency
groupIdorg.apache.cxf/groupId
artifactIdcxf-rt-frontend-jaxws/artifactId
version${cxf.version}/version
exclusions
exclusion
groupIdasm/groupId
artifactIdasm/artifactId
/exclusion
/exclusions
/dependency
dependency
groupIdorg.apache.cxf/groupId
artifactIdcxf-rt-transports-http/artifactId
version${cxf.version}/version
/dependency
dependency
groupIdorg.apache.cxf/groupId
artifactIdcxf-rt-bindings-soap/artifactId
version${cxf.version}/version
/dependency
dependency
groupIdasm/groupId
artifactIdasm-all/artifactId
version3.0/version
/dependency
dependency
groupIdcglib/groupId
artifactIdcglib-nodep/artifactId
version2.1_3/version
/dependency


Now Jetty starts correctly but when I try to call a service using the
Spring+Hibernate service layer I get the exception:

Sep 13, 2007 10:20:41 AM org.apache.cxf.phase.PhaseInterceptorChaindoIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault:
org.springframework.util.ClassUtils.getMostSpe
cificMethod(Ljava/lang/reflect/Method;Ljava/lang/Class;)Ljava/lang/reflect/Metho
d;


Someone with the same problem?



Thanks,
Vicio.



On 9/12/07, Juan José Vázquez Delgado [EMAIL PROTECTED] wrote:

 I had to add this dependencies:

 dependency
 groupIdasm/groupId
 artifactIdasm-all/artifactId
 version3.0/version
 /dependency
 dependency
 groupIdcglib/groupId
 artifactIdcglib-nodep/artifactId
 version2.1_3/version
 /dependency

 On 9/12/07, Vincenzo Vitale [EMAIL PROTECTED] wrote:
 
  Hi,
 
  in my project I use Hibernate 3.2.4.sp1 and with cxf 2.0.1-incubator I
 get
  the exception:
 
  org.springframework.beans.factory.BeanCreationException: Error creating
  bean
  with name 'sessionFactory' defined in class path resource [
  oasis-db-context.xml]: Invocation of init method failed; nested
 exception
  is
  java.lang.NoClassDefFoundError
  Caused by:
  java.lang.NoClassDefFoundError
  at
 org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory
  (
  CGLIBLazyInitializer.java :117)
 
  when the server starts.
 
  Here I have red it could be for the asm library but also excluding it in
  the
  pom file the problem persist.
 
  I solved it just using cxf 2.0-incubator but maybe there is another
  solution
  using the last cxf release.
 
 
  Someone with the same problem?
 
 
 
  Ciao,
  V.
 



Hibernate and cxf 2.01 problem.

2007-09-12 Thread Vincenzo Vitale
Hi,

in my project I use Hibernate 3.2.4.sp1 and with cxf 2.0.1-incubator I get
the exception:

org.springframework.beans.factory.BeanCreationException: Error creating bean
with name 'sessionFactory' defined in class path resource [
oasis-db-context.xml]: Invocation of init method failed; nested exception is
java.lang.NoClassDefFoundError
Caused by:
java.lang.NoClassDefFoundError
at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.getProxyFactory(
CGLIBLazyInitializer.java :117)

when the server starts.

Here I have red it could be for the asm library but also excluding it in the
pom file the problem persist.

I solved it just using cxf 2.0-incubator but maybe there is another solution
using the last cxf release.


Someone with the same problem?



Ciao,
V.


Re: What are the min Maven2 dependencies?

2007-09-11 Thread Vincenzo Vitale
artifactIdslf4j-jcl/artifactId
version1.4.0/version
typejar/type
/dependency
dependency
groupIdlog4j/groupId
artifactIdlog4j/artifactId
version${log4j.version}/version
typejar/type
/dependency
/dependencies
configuration
contextPath/webservices/contextPath
!--
We need to specify our file to turn off the
useFileMappedBuffer
parametere value that cause Windows locking
problems.
--
webDefaultXml
src/main/resources/jetty-webdefault.xml
/webDefaultXml
!--
JNDI sources definition.
--
jettyEnvXml
src/main/resources/jetty-env.xml
/jettyEnvXml
classesDirectory
eclipse-classes
/classesDirectory
/configuration
/plugin
/plugins
/build
/profile
/profiles
/project

On 9/11/07, Jacob Marcus [EMAIL PROTECTED] wrote:

 Vincezo,

 You will find the information here.

 http://cwiki.apache.org/CXF20DOC/maven-integration-and-plugin.html.

 If you are using Aegis databinding, you will need to add that dependency.

 jacob

 On 9/11/07, Vincenzo Vitale [EMAIL PROTECTED] wrote:
 
  Hello all,
 
  I'm trying to expose a simple Spring service with CXF.
 
  I use Maven2 and the maven Jetty plug in to start the application during
  development.
 
  What are the minimal dependencies I must add to my pom file?
 
 
 
  Thanks,
  Vincenzo.
 



Re: What are the min Maven2 dependencies?

2007-09-11 Thread Vincenzo Vitale
Solved the first problem adding:

dependency
groupIdjavax.xml.bind/groupId
artifactIdjaxb-api/artifactId
version2.1/version
/dependency

Now I obtain:
java.lang.NoClassDefFoundError: javax/xml/soap/SOAPException



On 9/11/07, Vincenzo Vitale [EMAIL PROTECTED] wrote:

 Hi Jacob,

 thanks for your reply.

 I already have set these dependencies but I got the exception:
 Embedded error: Object is not of type class
 org.mortbay.jetty.webapp.WebAppConte
 xt

 If I remove the last dependency then I got the exception:

 java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

 My pom is:

 project xmlns= http://maven.apache.org/POM/4.0.0;
 xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance;
 xsi:schemaLocation= http://maven.apache.org/POM/4.0.0
 http://maven.apache.org/maven-v4_0_0.xsd;

 parent
 groupIdcom.tomtom.oasis/groupId
 artifactIdoasis/artifactId
 version1.1-SNAPSHOT/version
 /parent

 modelVersion4.0.0/modelVersion
 artifactIdoasis-ws-war/artifactId
 packagingwar/packaging
 version1.1-SNAPSHOT/version

 nameOasis Web Services Application/name
 description
 The module providing a WAR file containing the Oasis Web
 Services Application.
 /description

 dependencies

 dependency
 groupIdorg.slf4j/groupId
 artifactIdslf4j-jcl/artifactId
 version1.4.0/version
 typejar/type
 /dependency
 dependency
 groupIdaspectj/groupId
 artifactIdaspectjweaver/artifactId
 version${aspectj.version}/version
 /dependency
 dependency
 groupIdlog4j/groupId
 artifactIdlog4j/artifactId
 version${log4j.version}/version
 scopeprovided/scope
 /dependency
 dependency
 groupIdjunit/groupId
 artifactIdjunit/artifactId
 version${junit.version}/version
 scopetest/scope
 /dependency
 dependency
 groupIdorg.easymock/groupId
 artifactIdeasymock/artifactId
 version${easymock.version}/version
 scopetest/scope
 /dependency
 dependency
 groupIdjavax.servlet/groupId
 artifactIdjstl/artifactId
 version${jstl.version }/version
 /dependency
 dependency
 groupIdjavax.servlet/groupId
 artifactIdservlet-api/artifactId
 version${ servlet.version}/version
 scopeprovided/scope
 /dependency
 dependency
 groupIdtaglibs/groupId
 artifactIdstandard/artifactId
 version${taglibs.version}/version
 /dependency

 !--
 Web Services framework.
 --
 dependency
 groupId org.apache.cxf/groupId
 artifactIdcxf-rt-frontend-jaxws/artifactId
 version${cxf.version}/version
 /dependency
 dependency
 groupIdorg.apache.cxf/groupId
 artifactIdcxf-rt-transports-http/artifactId
 version${cxf.version}/version
 /dependency
 !-- Jetty is needed if you're are not using the CXFServlet --
 !-- dependency
 groupIdorg.apache.cxf/groupId
 artifactIdcxf-rt-transports-http-jetty/artifactId
 version${cxf.version}/version
 /dependency --
 /dependencies

 build
 resources
 resource
 filteringfalse/filtering
 directorysrc/main/java/directory
 includes
 include**/include
 /includes
 excludes
 exclude**/*.java/exclude
 /excludes
 /resource
 resource
 filteringfalse/filtering
 directorysrc/main/resources/directory
 includes
 include**/include
 /includes
 /resource
 /resources
 finalNameoasis-ws/finalName
 /build
 profiles
 !-- Use 'mvn -P maven-jetty jetty:run' to run jetty--
 profile
 idmaven-jetty/id
 build
 plugins
 plugin
 groupIdorg.mortbay.jetty/groupId
 artifactIdmaven-jetty-plugin/artifactId
 version6.0.1/version
 dependencies
 dependency
 groupIdmysql/groupId
 artifactId
 mysql-connector-java
 /artifactId
 version${mysql.version}/version
 /dependency