You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by kpalania <kp...@yahoo.com> on 2008/12/31 01:23:58 UTC

How to call a REST Service from Java using POST?

I use the Apache HttpClient/PostMethod APIs and am able to successfully call
the REST services so long I pass the parameters as part of the URL (use
JAX-WS). However, I have a large content to send and therefore, need to make
it part of the POST Request Body. I can't seem to find another way to pass
the payload other than stick it in the URL which, ofcourse, fails owing to
the 4K limitation (apparently). Any thoughts?
-- 
View this message in context: http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21225373.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to call a REST Service from Java using POST?

Posted by Julio Oliveira <ju...@gmail.com>.
Next week will be ready and i'll send to u. Now i have the response working,
i'm deploying the client.
See FUSE example jax-rs i take this as model for doing my WS.


regards

On Wed, Dec 31, 2008 at 1:25 PM, kpalania <kp...@yahoo.com> wrote:

>
> So do you send the content as the request body? Do you have an example of
> this?
>
>
> Julio Oliveira wrote:
> >
> > You can use a Bean to send and to return values.I use Rest Post  to send
> a
> > String (XML format) and convert it at the other side.
> > I use XStream to convert from JavaBean object  to xml String  and xml to
> > JavaBean in only one line of code.
> >
> > My test say that the problem is the JVM memmory only, i return an
> > ArrayList
> > to JavaBean of  2000 records  by   49 properties without problem.
> >
> > regards
> > julio Oliveira
> >
> > On Tue, Dec 30, 2008 at 11:15 PM, Benson Margulies
> > <bi...@gmail.com>wrote:
> >
> >> I'm not the REST-expert, but I expect that there's some way indeed to
> >> use POST. I was just reacting to realizing that your 4-k-ish limit had
> >> to do with data encoded onto a URL.
> >>
> >> On Tue, Dec 30, 2008 at 9:13 PM, kpalania <kp...@yahoo.com> wrote:
> >> >
> >> > oh oh.. what does that mean? sorry but if you wouldn't mind
> >> elaborating..
> >> > basically, I use CXF quite heavily and am implementing RESTful
> services
> >> > using that for a number of different applications (deployed in various
> >> > containers). In 1 case, I have to pass a huge XML payload (about 6K)
> to
> >> a
> >> > REST service. I suppose there must be some way to do this, right?
> >> >
> >> > Ran into a @FormParam option but doesn't like the current (even the
> >> latest)
> >> > versions of CXF support that. Given that, what are my options?
> >> Certainly,
> >> > not using CXF is one but a rather difficult one. If this is infact a
> >> > limitation, why is it the case?
> >> >
> >> >
> >> >
> >> > Benson Margulies-4 wrote:
> >> >>
> >> >> You certainly can't have an unbounded URL. This isn't just CXF.
> >> >>
> >> >> On Tue, Dec 30, 2008 at 7:23 PM, kpalania <kp...@yahoo.com>
> wrote:
> >> >>>
> >> >>> I use the Apache HttpClient/PostMethod APIs and am able to
> >> successfully
> >> >>> call
> >> >>> the REST services so long I pass the parameters as part of the URL
> >> (use
> >> >>> JAX-WS). However, I have a large content to send and therefore, need
> >> to
> >> >>> make
> >> >>> it part of the POST Request Body. I can't seem to find another way
> to
> >> >>> pass
> >> >>> the payload other than stick it in the URL which, ofcourse, fails
> >> owing
> >> >>> to
> >> >>> the 4K limitation (apparently). Any thoughts?
> >> >>> --
> >> >>> View this message in context:
> >> >>>
> >>
> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21225373.html
> >> >>> Sent from the cxf-user mailing list archive at Nabble.com.
> >> >>>
> >> >>>
> >> >>
> >> >>
> >> >
> >> > --
> >> > View this message in context:
> >>
> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21226250.html
> >> > Sent from the cxf-user mailing list archive at Nabble.com.
> >> >
> >> >
> >>
> >
> >
> >
> > --
> > Saludos
> >
> > Julio Oliveira - Buenos Aires
> >
> > julio.julioOliveira@gmail.com
> >
> > http://www.linkedin.com/in/juliomoliveira
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21233654.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>


-- 
Saludos

Julio Oliveira - Buenos Aires

julio.julioOliveira@gmail.com

http://www.linkedin.com/in/juliomoliveira

Re: How to call a REST Service from Java using POST?

Posted by kpalania <kp...@yahoo.com>.
So do you send the content as the request body? Do you have an example of
this?


Julio Oliveira wrote:
> 
> You can use a Bean to send and to return values.I use Rest Post  to send a
> String (XML format) and convert it at the other side.
> I use XStream to convert from JavaBean object  to xml String  and xml to
> JavaBean in only one line of code.
> 
> My test say that the problem is the JVM memmory only, i return an
> ArrayList
> to JavaBean of  2000 records  by   49 properties without problem.
> 
> regards
> julio Oliveira
> 
> On Tue, Dec 30, 2008 at 11:15 PM, Benson Margulies
> <bi...@gmail.com>wrote:
> 
>> I'm not the REST-expert, but I expect that there's some way indeed to
>> use POST. I was just reacting to realizing that your 4-k-ish limit had
>> to do with data encoded onto a URL.
>>
>> On Tue, Dec 30, 2008 at 9:13 PM, kpalania <kp...@yahoo.com> wrote:
>> >
>> > oh oh.. what does that mean? sorry but if you wouldn't mind
>> elaborating..
>> > basically, I use CXF quite heavily and am implementing RESTful services
>> > using that for a number of different applications (deployed in various
>> > containers). In 1 case, I have to pass a huge XML payload (about 6K) to
>> a
>> > REST service. I suppose there must be some way to do this, right?
>> >
>> > Ran into a @FormParam option but doesn't like the current (even the
>> latest)
>> > versions of CXF support that. Given that, what are my options?
>> Certainly,
>> > not using CXF is one but a rather difficult one. If this is infact a
>> > limitation, why is it the case?
>> >
>> >
>> >
>> > Benson Margulies-4 wrote:
>> >>
>> >> You certainly can't have an unbounded URL. This isn't just CXF.
>> >>
>> >> On Tue, Dec 30, 2008 at 7:23 PM, kpalania <kp...@yahoo.com> wrote:
>> >>>
>> >>> I use the Apache HttpClient/PostMethod APIs and am able to
>> successfully
>> >>> call
>> >>> the REST services so long I pass the parameters as part of the URL
>> (use
>> >>> JAX-WS). However, I have a large content to send and therefore, need
>> to
>> >>> make
>> >>> it part of the POST Request Body. I can't seem to find another way to
>> >>> pass
>> >>> the payload other than stick it in the URL which, ofcourse, fails
>> owing
>> >>> to
>> >>> the 4K limitation (apparently). Any thoughts?
>> >>> --
>> >>> View this message in context:
>> >>>
>> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21225373.html
>> >>> Sent from the cxf-user mailing list archive at Nabble.com.
>> >>>
>> >>>
>> >>
>> >>
>> >
>> > --
>> > View this message in context:
>> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21226250.html
>> > Sent from the cxf-user mailing list archive at Nabble.com.
>> >
>> >
>>
> 
> 
> 
> -- 
> Saludos
> 
> Julio Oliveira - Buenos Aires
> 
> julio.julioOliveira@gmail.com
> 
> http://www.linkedin.com/in/juliomoliveira
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21233654.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to call a REST Service from Java using POST?

Posted by Julio Oliveira <ju...@gmail.com>.
You can use a Bean to send and to return values.I use Rest Post  to send a
String (XML format) and convert it at the other side.
I use XStream to convert from JavaBean object  to xml String  and xml to
JavaBean in only one line of code.

My test say that the problem is the JVM memmory only, i return an ArrayList
to JavaBean of  2000 records  by   49 properties without problem.

regards
julio Oliveira

On Tue, Dec 30, 2008 at 11:15 PM, Benson Margulies <bi...@gmail.com>wrote:

> I'm not the REST-expert, but I expect that there's some way indeed to
> use POST. I was just reacting to realizing that your 4-k-ish limit had
> to do with data encoded onto a URL.
>
> On Tue, Dec 30, 2008 at 9:13 PM, kpalania <kp...@yahoo.com> wrote:
> >
> > oh oh.. what does that mean? sorry but if you wouldn't mind elaborating..
> > basically, I use CXF quite heavily and am implementing RESTful services
> > using that for a number of different applications (deployed in various
> > containers). In 1 case, I have to pass a huge XML payload (about 6K) to a
> > REST service. I suppose there must be some way to do this, right?
> >
> > Ran into a @FormParam option but doesn't like the current (even the
> latest)
> > versions of CXF support that. Given that, what are my options? Certainly,
> > not using CXF is one but a rather difficult one. If this is infact a
> > limitation, why is it the case?
> >
> >
> >
> > Benson Margulies-4 wrote:
> >>
> >> You certainly can't have an unbounded URL. This isn't just CXF.
> >>
> >> On Tue, Dec 30, 2008 at 7:23 PM, kpalania <kp...@yahoo.com> wrote:
> >>>
> >>> I use the Apache HttpClient/PostMethod APIs and am able to successfully
> >>> call
> >>> the REST services so long I pass the parameters as part of the URL (use
> >>> JAX-WS). However, I have a large content to send and therefore, need to
> >>> make
> >>> it part of the POST Request Body. I can't seem to find another way to
> >>> pass
> >>> the payload other than stick it in the URL which, ofcourse, fails owing
> >>> to
> >>> the 4K limitation (apparently). Any thoughts?
> >>> --
> >>> View this message in context:
> >>>
> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21225373.html
> >>> Sent from the cxf-user mailing list archive at Nabble.com.
> >>>
> >>>
> >>
> >>
> >
> > --
> > View this message in context:
> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21226250.html
> > Sent from the cxf-user mailing list archive at Nabble.com.
> >
> >
>



-- 
Saludos

Julio Oliveira - Buenos Aires

julio.julioOliveira@gmail.com

http://www.linkedin.com/in/juliomoliveira

Re: How to call a REST Service from Java using POST?

Posted by Benson Margulies <bi...@gmail.com>.
I'm not the REST-expert, but I expect that there's some way indeed to
use POST. I was just reacting to realizing that your 4-k-ish limit had
to do with data encoded onto a URL.

On Tue, Dec 30, 2008 at 9:13 PM, kpalania <kp...@yahoo.com> wrote:
>
> oh oh.. what does that mean? sorry but if you wouldn't mind elaborating..
> basically, I use CXF quite heavily and am implementing RESTful services
> using that for a number of different applications (deployed in various
> containers). In 1 case, I have to pass a huge XML payload (about 6K) to a
> REST service. I suppose there must be some way to do this, right?
>
> Ran into a @FormParam option but doesn't like the current (even the latest)
> versions of CXF support that. Given that, what are my options? Certainly,
> not using CXF is one but a rather difficult one. If this is infact a
> limitation, why is it the case?
>
>
>
> Benson Margulies-4 wrote:
>>
>> You certainly can't have an unbounded URL. This isn't just CXF.
>>
>> On Tue, Dec 30, 2008 at 7:23 PM, kpalania <kp...@yahoo.com> wrote:
>>>
>>> I use the Apache HttpClient/PostMethod APIs and am able to successfully
>>> call
>>> the REST services so long I pass the parameters as part of the URL (use
>>> JAX-WS). However, I have a large content to send and therefore, need to
>>> make
>>> it part of the POST Request Body. I can't seem to find another way to
>>> pass
>>> the payload other than stick it in the URL which, ofcourse, fails owing
>>> to
>>> the 4K limitation (apparently). Any thoughts?
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21225373.html
>>> Sent from the cxf-user mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21226250.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Re: How to call a REST Service from Java using POST?

Posted by kpalania <kp...@yahoo.com>.
oh oh.. what does that mean? sorry but if you wouldn't mind elaborating..
basically, I use CXF quite heavily and am implementing RESTful services
using that for a number of different applications (deployed in various
containers). In 1 case, I have to pass a huge XML payload (about 6K) to a
REST service. I suppose there must be some way to do this, right?

Ran into a @FormParam option but doesn't like the current (even the latest)
versions of CXF support that. Given that, what are my options? Certainly,
not using CXF is one but a rather difficult one. If this is infact a
limitation, why is it the case?



Benson Margulies-4 wrote:
> 
> You certainly can't have an unbounded URL. This isn't just CXF.
> 
> On Tue, Dec 30, 2008 at 7:23 PM, kpalania <kp...@yahoo.com> wrote:
>>
>> I use the Apache HttpClient/PostMethod APIs and am able to successfully
>> call
>> the REST services so long I pass the parameters as part of the URL (use
>> JAX-WS). However, I have a large content to send and therefore, need to
>> make
>> it part of the POST Request Body. I can't seem to find another way to
>> pass
>> the payload other than stick it in the URL which, ofcourse, fails owing
>> to
>> the 4K limitation (apparently). Any thoughts?
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21225373.html
>> Sent from the cxf-user mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21226250.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: How to call a REST Service from Java using POST?

Posted by Benson Margulies <bi...@gmail.com>.
You certainly can't have an unbounded URL. This isn't just CXF.

On Tue, Dec 30, 2008 at 7:23 PM, kpalania <kp...@yahoo.com> wrote:
>
> I use the Apache HttpClient/PostMethod APIs and am able to successfully call
> the REST services so long I pass the parameters as part of the URL (use
> JAX-WS). However, I have a large content to send and therefore, need to make
> it part of the POST Request Body. I can't seem to find another way to pass
> the payload other than stick it in the URL which, ofcourse, fails owing to
> the 4K limitation (apparently). Any thoughts?
> --
> View this message in context: http://www.nabble.com/How-to-call-a-REST-Service-from-Java-using-POST--tp21225373p21225373.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>