You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Siarhei Barysiuk <s....@gmail.com> on 2009/08/24 12:20:12 UTC

Using RESTful services with J2ME client

Hi,

I'm working on application which consists from 2 parts: backend services and
mobile java client (J2ME). The main idea that server exposes some services
and mobile client uses them, pretty standard. RESTful web services looks
more lightweight and more flexible in this particular situation and I would
like to use Apache CXF implementation. So, everything is clear with server
side. But I have some questions regarding client side. 

The main problem which I faced with that J2ME does not support all HTTP
headers.
(http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Modules/j2me/com/sun/midp/io/j2me/http/Protocol.java.htm
See setRequestMethod implementation.) So I cannot use "fully RESTful" way
but can emulate this by using method name in URL like /book/{id}/delete.
Does anyone use built-in CXF Client API with J2ME? Is it possible at all to
use for example HTTP-centric clients?
I know that I can build REST services client by myself, parse resulting XML,
etc. but built-in clients are really time saver.

Maybe someone had experience with similar project, I would appreciate any
suggestions.

Thanks,
Serge Barysiuk

-- 
View this message in context: http://www.nabble.com/Using-RESTful-services-with-J2ME-client-tp25113577p25113577.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using RESTful services with J2ME client

Posted by Sergey Beryozkin <se...@iona.com>.
Hi Serge,

> That's exactly what I was looking for - _method parameter.

great...

> I've just realized that all HTTP clients use JAXB to marshall/unmarshall
> objects

JAXRS-aware clients like CXF JAXRS can register alternative providers, for
example, Aegis or XMLBeans or some other databinding can be used in CXF on
the client side. 

cheers, Sergey


Siarhei Barysiuk wrote:
> 
> Hi Sergey,
> 
> Thanks for your feedback.
> 
> That's exactly what I was looking for - _method parameter.
> 
> I've just realized that all HTTP clients use JAXB to marshall/unmarshall
> objects, so I suppose it it's impossible to use them on client side
> (J2ME).
> 
> Thanks,
> Serge
> 
> 
> Sergey Beryozkin wrote:
>> 
>> Hi Serge
>> 
>> You might want to set the following HTTP header :
>> 
>> X-HTTP-Method-Override : DELETE
>> 
>> CXF will assume that DELETE HTTP method was actually used.
>> 
>> _method queries can also be used. Some more info is here :
>> 
>> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-OverridingHTTPmethod
>> 
>> cheers, Sergey
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-RESTful-services-with-J2ME-client-tp25113577p25116709.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using RESTful services with J2ME client

Posted by Siarhei Barysiuk <s....@gmail.com>.
Hi Sergey,

Thanks for your feedback.

That's exactly what I was looking for - _method parameter.

I've just realized that all HTTP clients use JAXB to marshall/unmarshall
objects, so I suppose it it's impossible to use them on client side (J2ME).

Thanks,
Serge


Sergey Beryozkin wrote:
> 
> Hi Serge
> 
> You might want to set the following HTTP header :
> 
> X-HTTP-Method-Override : DELETE
> 
> CXF will assume that DELETE HTTP method was actually used.
> 
> _method queries can also be used. Some more info is here :
> 
> http://cxf.apache.org/docs/jax-rs.html#JAX-RS-OverridingHTTPmethod
> 
> cheers, Sergey
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-RESTful-services-with-J2ME-client-tp25113577p25116365.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Using RESTful services with J2ME client

Posted by Sergey Beryozkin <se...@iona.com>.
Hi Serge

You might want to set the following HTTP header :

X-HTTP-Method-Override : DELETE

CXF will assume that DELETE HTTP method was actually used.

_method queries can also be used. Some more info is here :

http://cxf.apache.org/docs/jax-rs.html#JAX-RS-OverridingHTTPmethod

cheers, Sergey


Siarhei Barysiuk wrote:
> 
> Hi,
> 
> I'm working on application which consists from 2 parts: backend services
> and mobile java client (J2ME). The main idea that server exposes some
> services and mobile client uses them, pretty standard. RESTful web
> services looks more lightweight and more flexible in this particular
> situation and I would like to use Apache CXF implementation. So,
> everything is clear with server side. But I have some questions regarding
> client side. 
> 
> The main problem which I faced with that J2ME does not support all HTTP
> headers.
> (http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Modules/j2me/com/sun/midp/io/j2me/http/Protocol.java.htm
> See setRequestMethod implementation.) So I cannot use "fully RESTful" way
> but can emulate this by using method name in URL like /book/{id}/delete.
> Does anyone use built-in CXF Client API with J2ME? Is it possible at all
> to use for example HTTP-centric clients?
> I know that I can build REST services client by myself, parse resulting
> XML, etc. but built-in clients are really time saver.
> 
> Maybe someone had experience with similar project, I would appreciate any
> suggestions.
> 
> Thanks,
> Serge Barysiuk
> 
> 

-- 
View this message in context: http://www.nabble.com/Using-RESTful-services-with-J2ME-client-tp25113577p25115829.html
Sent from the cxf-user mailing list archive at Nabble.com.