Hi,

Is it a JAXRS-based service ? Or do you use an older CXF Http Binding ?
Also, is it an Aegis Provider (provided it is JAX-RS) that you use ?

Assuming it is JAX-RS, do you have a resource like this :

@Path("/")
public class SomeResource {

  @POST
  @Path("/")
  void postFoo(List<Foo> list) {}
  
  @POST
  @Path("/")
  void postBar(List<Bar> list) {}
}

?

I'm not sure it can work. The selection algorithm will pick up the first method 
due to the fact that even though it might be Bar which is coming on the wire, 
the first method will still be chosen, as both methods are equal candidates, 
the selection is done before the deserialization has started.

Is it possible for you to introduce a class like ListWrapper which will have a 
List field, say List<AbstractFooBar> and ensure you always have a common root 
element name for the incoming data (equal to XmlRootElement value attached to 
ListWrapper) ? It will let you have a single method accepting ListWrapper ...

cheers, Sergey
 

-----Original Message-----
From: Alan Hazelton [mailto:[email protected]]
Sent: Tue 1/5/2010 12:23 AM
To: [email protected]
Subject: Issue with multiple REST methods having List<T> arguments
 

I have a REST based service method that take a List<Foo> parameter.  The
method is annotated with @POST and I can verify that the XML body of the
POST request from the server expects the top level element to be
<ArrayOfFoo>.

This part is working for me.  The issue is when I add a second method that
takes a List<Bar> parameter that is in a different namespace.

What happens is the first method to be invoked works perfectly fine.  The
second method results in a 500 error at the server with the following
exception in the server.log:
WARNING:
xsi:type="{http://bar.services.v1.sdk.platform.axeda.com}ArrayOfBar"; was
specified, but no corresponding Type was registered; no default.

It appears that the second ArrayOf<T> type is looked up in the namespace of
the first ArrayOf<T> method and is not found.  

Both the Foo.class and Bar.class have the @XmlRootElement annotations and
like I said, each works well independently.  I'm using CXF 2.2.5.  Any help
is greatly appreciated.

-- 
View this message in context: 
http://old.nabble.com/Issue-with-multiple-REST-methods-having-List%3CT%3E-arguments-tp27023942p27023942.html
Sent from the cxf-user mailing list archive at Nabble.com.


Reply via email to