You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Alan Hazelton (JIRA)" <ji...@apache.org> on 2010/01/07 15:00:18 UTC

[jira] Created: (CXF-2604) Issue with multiple REST methods having List arguments

Issue with multiple REST methods having List<T> arguments
---------------------------------------------------------

                 Key: CXF-2604
                 URL: https://issues.apache.org/jira/browse/CXF-2604
             Project: CXF
          Issue Type: Bug
          Components: Aegis Databinding, JAX-RS
    Affects Versions: 2.2.5
         Environment: JBoss 4.3 Using CXF 2.2.5
            Reporter: Alan Hazelton


I have a REST based service method that takes 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> and a second method that takes a List<Bar> parameter.

It is important to note that the Foo and Bar classes are in different packages and therefore the namespaces are different.

The service would look something like this:
My resource is defined like this:
@Path("/")
public class SomeResource {

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

When I stop the server in the debugger after posting to "/foo/update" I can see that in the org.apache.cxf.aegis.type.TypeUtil class the getReadTypeStandalone() method is invoked to get the top level type.  In this case it will be ArrayOfFoo and the type is located and my method called with the correct list object un-marshalled from XML.

In the second case, when posting to "/bar/update", ArrayOfBar is not found in the AegisContext and null is returned by the getReadTypeStandalone method.

The part that really confuses me is that if at runtime (after restarting the server) I invoke the postBar method before invoking the postFoo method, the ArrayOfBar type is located but not the ArrayOfFoo type.

Some important things to note:
1.  This seems to only affect the ArrayOf<T> classes.   Other custom classes from different namespaces are fine.
2.  This only happens when ArrayOfBar is in a different namespace from ArrayOfFoo.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2604) Issue with multiple REST methods having List arguments

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798107#action_12798107 ] 

Daniel Kulp commented on CXF-2604:
----------------------------------



Any chance you could test this with the 2.3 snapshots?    This MAY be fixed there.   I think aegis on 2.2.x just know the root "class", in this case "List" and just kind of guesses on the internal stuff but I think Benson addes some support for the "generics" things on trunk to pick up the internal type.   Not 100% sure though.

> Issue with multiple REST methods having List<T> arguments
> ---------------------------------------------------------
>
>                 Key: CXF-2604
>                 URL: https://issues.apache.org/jira/browse/CXF-2604
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding, JAX-RS
>    Affects Versions: 2.2.5
>         Environment: JBoss 4.3 Using CXF 2.2.5
>            Reporter: Alan Hazelton
>         Attachments: CustomAegisElementProvider.java
>
>
> I have a REST based service method that takes 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> and a second method that takes a List<Bar> parameter.
> It is important to note that the Foo and Bar classes are in different packages and therefore the namespaces are different.
> The service would look something like this:
> My resource is defined like this:
> @Path("/")
> public class SomeResource {
>   @POST
>   @Path("/foo/update")
>   void postFoo(List<Foo> list) {}
>  
>   @POST
>   @Path("/bar/update")
>   void postBar(List<Bar> list) {}
> } 
> When I stop the server in the debugger after posting to "/foo/update" I can see that in the org.apache.cxf.aegis.type.TypeUtil class the getReadTypeStandalone() method is invoked to get the top level type.  In this case it will be ArrayOfFoo and the type is located and my method called with the correct list object un-marshalled from XML.
> In the second case, when posting to "/bar/update", ArrayOfBar is not found in the AegisContext and null is returned by the getReadTypeStandalone method.
> The part that really confuses me is that if at runtime (after restarting the server) I invoke the postBar method before invoking the postFoo method, the ArrayOfBar type is located but not the ArrayOfFoo type.
> Some important things to note:
> 1.  This seems to only affect the ArrayOf<T> classes.   Other custom classes from different namespaces are fine.
> 2.  This only happens when ArrayOfBar is in a different namespace from ArrayOfFoo.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2604) Issue with multiple REST methods having List arguments

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12797967#action_12797967 ] 

Sergey Beryozkin commented on CXF-2604:
---------------------------------------

Alan, how do you enable Aegis, by registering AegisElementProvider or using jaxrs:databinding ? 

> Issue with multiple REST methods having List<T> arguments
> ---------------------------------------------------------
>
>                 Key: CXF-2604
>                 URL: https://issues.apache.org/jira/browse/CXF-2604
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding, JAX-RS
>    Affects Versions: 2.2.5
>         Environment: JBoss 4.3 Using CXF 2.2.5
>            Reporter: Alan Hazelton
>
> I have a REST based service method that takes 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> and a second method that takes a List<Bar> parameter.
> It is important to note that the Foo and Bar classes are in different packages and therefore the namespaces are different.
> The service would look something like this:
> My resource is defined like this:
> @Path("/")
> public class SomeResource {
>   @POST
>   @Path("/foo/update")
>   void postFoo(List<Foo> list) {}
>  
>   @POST
>   @Path("/bar/update")
>   void postBar(List<Bar> list) {}
> } 
> When I stop the server in the debugger after posting to "/foo/update" I can see that in the org.apache.cxf.aegis.type.TypeUtil class the getReadTypeStandalone() method is invoked to get the top level type.  In this case it will be ArrayOfFoo and the type is located and my method called with the correct list object un-marshalled from XML.
> In the second case, when posting to "/bar/update", ArrayOfBar is not found in the AegisContext and null is returned by the getReadTypeStandalone method.
> The part that really confuses me is that if at runtime (after restarting the server) I invoke the postBar method before invoking the postFoo method, the ArrayOfBar type is located but not the ArrayOfFoo type.
> Some important things to note:
> 1.  This seems to only affect the ArrayOf<T> classes.   Other custom classes from different namespaces are fine.
> 2.  This only happens when ArrayOfBar is in a different namespace from ArrayOfFoo.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CXF-2604) Issue with multiple REST methods having List arguments

Posted by "Alan Hazelton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CXF-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798011#action_12798011 ] 

Alan Hazelton commented on CXF-2604:
------------------------------------

Using an AegisElementProvider via Spring:

  <bean id="aegisProvider" class="com.axeda.sl.webservices.v1.cxf.provider.CustomAegisElementProvider"/>
  <jaxrs:server address="/v1/rest">
	<jaxrs:serviceBeans>
          <ref bean="helloworldWServiceBean"/>
	</jaxrs:serviceBeans>
	<jaxrs:providers>
	   <ref bean="customRequestHandlerProvider"/>
           <ref bean="customFormProvider"/>
	   <ref bean="aegisProvider"/>
	</jaxrs:providers>
        <jaxrs:languageMappings/>
</jaxrs:server>

I'll attach the provider but it is pretty much an empty class that extends AegisElementProvider and calls the superclass methods in everything overridden.
I didn't add this part so I'm not sure why its there.

> Issue with multiple REST methods having List<T> arguments
> ---------------------------------------------------------
>
>                 Key: CXF-2604
>                 URL: https://issues.apache.org/jira/browse/CXF-2604
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding, JAX-RS
>    Affects Versions: 2.2.5
>         Environment: JBoss 4.3 Using CXF 2.2.5
>            Reporter: Alan Hazelton
>
> I have a REST based service method that takes 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> and a second method that takes a List<Bar> parameter.
> It is important to note that the Foo and Bar classes are in different packages and therefore the namespaces are different.
> The service would look something like this:
> My resource is defined like this:
> @Path("/")
> public class SomeResource {
>   @POST
>   @Path("/foo/update")
>   void postFoo(List<Foo> list) {}
>  
>   @POST
>   @Path("/bar/update")
>   void postBar(List<Bar> list) {}
> } 
> When I stop the server in the debugger after posting to "/foo/update" I can see that in the org.apache.cxf.aegis.type.TypeUtil class the getReadTypeStandalone() method is invoked to get the top level type.  In this case it will be ArrayOfFoo and the type is located and my method called with the correct list object un-marshalled from XML.
> In the second case, when posting to "/bar/update", ArrayOfBar is not found in the AegisContext and null is returned by the getReadTypeStandalone method.
> The part that really confuses me is that if at runtime (after restarting the server) I invoke the postBar method before invoking the postFoo method, the ArrayOfBar type is located but not the ArrayOfFoo type.
> Some important things to note:
> 1.  This seems to only affect the ArrayOf<T> classes.   Other custom classes from different namespaces are fine.
> 2.  This only happens when ArrayOfBar is in a different namespace from ArrayOfFoo.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CXF-2604) Issue with multiple REST methods having List arguments

Posted by "Sergey Beryozkin (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-2604.
-----------------------------------

    Resolution: Won't Fix

Please reopen if the issue persists

> Issue with multiple REST methods having List<T> arguments
> ---------------------------------------------------------
>
>                 Key: CXF-2604
>                 URL: https://issues.apache.org/jira/browse/CXF-2604
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding, JAX-RS
>    Affects Versions: 2.2.5
>         Environment: JBoss 4.3 Using CXF 2.2.5
>            Reporter: Alan Hazelton
>         Attachments: CustomAegisElementProvider.java
>
>
> I have a REST based service method that takes 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> and a second method that takes a List<Bar> parameter.
> It is important to note that the Foo and Bar classes are in different packages and therefore the namespaces are different.
> The service would look something like this:
> My resource is defined like this:
> @Path("/")
> public class SomeResource {
>   @POST
>   @Path("/foo/update")
>   void postFoo(List<Foo> list) {}
>  
>   @POST
>   @Path("/bar/update")
>   void postBar(List<Bar> list) {}
> } 
> When I stop the server in the debugger after posting to "/foo/update" I can see that in the org.apache.cxf.aegis.type.TypeUtil class the getReadTypeStandalone() method is invoked to get the top level type.  In this case it will be ArrayOfFoo and the type is located and my method called with the correct list object un-marshalled from XML.
> In the second case, when posting to "/bar/update", ArrayOfBar is not found in the AegisContext and null is returned by the getReadTypeStandalone method.
> The part that really confuses me is that if at runtime (after restarting the server) I invoke the postBar method before invoking the postFoo method, the ArrayOfBar type is located but not the ArrayOfFoo type.
> Some important things to note:
> 1.  This seems to only affect the ArrayOf<T> classes.   Other custom classes from different namespaces are fine.
> 2.  This only happens when ArrayOfBar is in a different namespace from ArrayOfFoo.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CXF-2604) Issue with multiple REST methods having List arguments

Posted by "Alan Hazelton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan Hazelton updated CXF-2604:
-------------------------------

    Attachment: CustomAegisElementProvider.java

> Issue with multiple REST methods having List<T> arguments
> ---------------------------------------------------------
>
>                 Key: CXF-2604
>                 URL: https://issues.apache.org/jira/browse/CXF-2604
>             Project: CXF
>          Issue Type: Bug
>          Components: Aegis Databinding, JAX-RS
>    Affects Versions: 2.2.5
>         Environment: JBoss 4.3 Using CXF 2.2.5
>            Reporter: Alan Hazelton
>         Attachments: CustomAegisElementProvider.java
>
>
> I have a REST based service method that takes 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> and a second method that takes a List<Bar> parameter.
> It is important to note that the Foo and Bar classes are in different packages and therefore the namespaces are different.
> The service would look something like this:
> My resource is defined like this:
> @Path("/")
> public class SomeResource {
>   @POST
>   @Path("/foo/update")
>   void postFoo(List<Foo> list) {}
>  
>   @POST
>   @Path("/bar/update")
>   void postBar(List<Bar> list) {}
> } 
> When I stop the server in the debugger after posting to "/foo/update" I can see that in the org.apache.cxf.aegis.type.TypeUtil class the getReadTypeStandalone() method is invoked to get the top level type.  In this case it will be ArrayOfFoo and the type is located and my method called with the correct list object un-marshalled from XML.
> In the second case, when posting to "/bar/update", ArrayOfBar is not found in the AegisContext and null is returned by the getReadTypeStandalone method.
> The part that really confuses me is that if at runtime (after restarting the server) I invoke the postBar method before invoking the postFoo method, the ArrayOfBar type is located but not the ArrayOfFoo type.
> Some important things to note:
> 1.  This seems to only affect the ArrayOf<T> classes.   Other custom classes from different namespaces are fine.
> 2.  This only happens when ArrayOfBar is in a different namespace from ArrayOfFoo.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.