You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Estelle Peterson <es...@resonateinsights.com> on 2013/08/29 22:09:56 UTC

FW: @BeanParam with JAXRSClientFactory

Hi,

We're using the @BeanParam annotation on a method parameter with CXF version 2.7.5 shown below:

[cid:image011.png@01CEA4D0.F6CE6F80]

[cid:image007.png@01CEA4D1.51B50120]

For our REST integration tests, we seem to be running into some issues when the proxy client tries to build the URI.
We are using JAXRSClientFactory to construct our proxy and come across the following exception:

java.lang.IllegalArgumentException: Unresolved variables; only 0 value(s) given for 1 unique variable(s)

Has anyone run into this issue and was able to resolve this?

Thanks!

[cid:image001.jpg@01CEA4D0.A749D670]



[cid:image002.gif@01CEA4D0.A749D670]<http://www.facebook.com/ResonateNetworks/>

[cid:image003.gif@01CEA4D0.A749D670]<http://www.linkedin.com/company/327412/>

[cid:image004.gif@01CEA4D0.A749D670]<http://www.twitter.com/resonatetweets/>

[cid:image005.gif@01CEA4D0.A749D670]<http://www.resonateinsights.com/blog>






estelle peterson
software engineer


[cid:image008.gif@01CEA4D0.A749D670]11720 Plaza America Drive, 3rd Floor | Reston, VA 20190
[cid:image009.gif@01CEA4D0.A749D670]p | f 571.266.3250
[cid:image010.gif@01CEA4D0.A749D670]Estelle.Peterson@resonateinsights.com<ma...@resonateinsights.com>



Resonate was voted one of America's Most Promising Companies<http://www.forbes.com/lists/2011/28/most-promising-companies-11_Resonate-Networks_A1PE.html> by Forbes!

Re: FW: @BeanParam with JAXRSClientFactory

Posted by Sergey Beryozkin <sb...@gmail.com>.
On 29/08/13 23:05, Pedro Alvarado wrote:
> We’re using the @BeanParam annotation on a method parameter with CXF version
> 2.7.5 as shown below:
>
> @Path("/books")
> public interface BookService{
>
>    @PUT
>    @Path("/{id}")
>    Response updateBook(@BeanParam Book b);
> }
>
> public class Book {
>    private Long id;
>
>    @PathParam("id")
>    public void setId(Long id) {
>      this.id = id;
>    }
>
>    public Long getId() {
>      return id;
>    }
> }
>
>
> We are using the JAXRSClientFactory to create proxies for testing.
> Unfortunately, the proxy client doesn't seem to be able to parse the
> contents found inside the method bean argument.

yes, I confirmed in the previous email the proxies are not capable yet 
of working with BeanParams, simply use WebClient for now (no new Client 
API is supported in CXF 2.7.x, only on the trunk).

I've opened
https://issues.apache.org/jira/browse/CXF-5247

Sergey


>
> We get a:
>
> java.lang.IllegalArgumentException: Unresolved variables; only 0 value(s)
> given for 1 unique variable(s)
> 	at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.substituteVarargs(UriBuilderImpl.java:283)
> 	at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuildUriParts(UriBuilderImpl.java:120)
> 	at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuild(UriBuilderImpl.java:100)
> 	at
> org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildFromEncoded(UriBuilderImpl.java:228)
> 	at
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:165)
> 	at com.sun.proxy.$Proxy112.updateBook(Unknown Source)
>
>
> Any ideas what may be going on here? Help greatly appreciated.
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/FW-BeanParam-with-JAXRSClientFactory-tp5733312p5733314.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>


Re: FW: @BeanParam with JAXRSClientFactory

Posted by Pedro Alvarado <Pe...@resonateinsights.com>.
We’re using the @BeanParam annotation on a method parameter with CXF version
2.7.5 as shown below:

@Path("/books")
public interface BookService{

  @PUT
  @Path("/{id}")
  Response updateBook(@BeanParam Book b);
}

public class Book {
  private Long id;

  @PathParam("id")
  public void setId(Long id) {
    this.id = id;
  }

  public Long getId() {
    return id;
  }
}


We are using the JAXRSClientFactory to create proxies for testing.
Unfortunately, the proxy client doesn't seem to be able to parse the
contents found inside the method bean argument.

We get a:

java.lang.IllegalArgumentException: Unresolved variables; only 0 value(s)
given for 1 unique variable(s)
	at
org.apache.cxf.jaxrs.impl.UriBuilderImpl.substituteVarargs(UriBuilderImpl.java:283)
	at
org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuildUriParts(UriBuilderImpl.java:120)
	at
org.apache.cxf.jaxrs.impl.UriBuilderImpl.doBuild(UriBuilderImpl.java:100)
	at
org.apache.cxf.jaxrs.impl.UriBuilderImpl.buildFromEncoded(UriBuilderImpl.java:228)
	at
org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:165)
	at com.sun.proxy.$Proxy112.updateBook(Unknown Source)


Any ideas what may be going on here? Help greatly appreciated.



--
View this message in context: http://cxf.547215.n5.nabble.com/FW-BeanParam-with-JAXRSClientFactory-tp5733312p5733314.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: FW: @BeanParam with JAXRSClientFactory

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi
On 29/08/13 21:09, Estelle Peterson wrote:
> Hi,
>
> We’re using the @BeanParam annotation on a method parameter with CXF
> version 2.7.5 shown below:
>
> For our REST integration tests, we seem to be running into some issues
> when the proxy client tries to build the URI.
>
> We are using JAXRSClientFactory to construct our proxy and come across
> the following exception:
>
> java.lang.IllegalArgumentException: Unresolved variables; only 0
> value(s) given for 1 unique variable(s)
>
> Has anyone run into this issue and was able to resolve this?
>

The problem is that the RS client proxy code does not know how to handle 
BeanParams yet, it would need to extract all the properties representing 
query/header/etc parameters, I'll look into it when I get a chance.
Consider using WebClient in meantime

Cheers, Sergey

> Thanks!
>
> 	
>
> Find us on Facebook <http://www.facebook.com/ResonateNetworks/>
>
> 		
>
> Follow us on Linked In <http://www.linkedin.com/company/327412/>
>
> 		
>
> Follow us on Twitter <http://www.twitter.com/resonatetweets/>
>
> 		
>
> Follow our blog <http://www.resonateinsights.com/blog>
>
> 	
>
> 	
>
> 	
>
> *estelle peterson*
> software engineer
>
> 11720 Plaza America Drive, 3rd Floor | Reston, VA 20190
> *p*| *f* 571.266.3250
> Estelle.Peterson@resonateinsights.com
> <ma...@resonateinsights.com>
>
>
> Resonate was voted one of *America’s Most Promising Companies*
> <http://www.forbes.com/lists/2011/28/most-promising-companies-11_Resonate-Networks_A1PE.html>
> by Forbes!
>