You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Philipp Leitner <ph...@gmx.at> on 2007/04/16 12:05:55 UTC

REST over GET support in Java clients?

Hi folks,

I am wondering if there is support for REST over HTTP GET for Java 
clients in Axis2?

I know that there is the configuration parameter 
Constants.Configuration.ENABLE_REST_THROUGH_GET , but so far I  could 
not make it work.

I tried something like

<snip>
Options options = new Options();
options.setTo(new EndpointReference(toEpr));
options.setProperty(Constants.Configuration.ENABLE_REST,
    Constants.VALUE_TRUE); 
options.setProperty(Constants.Configuration.ENABLE_REST_THROUGH_GET,
    Constants.VALUE_TRUE);

ServiceClient sender = new ServiceClient();
sender.setOptions(options);
OMElement result = sender.sendReceive(
    OMAbstractFactory.getOMFactory().createOMElement("dummy", null));
</snip>

so far. I figure that the "payload" of an GET request should be null or 
something irrelevant, given that a GET request does not have a body to 
contain any payload?

A quick check with tcpmon showed me that this code actually works, but 
still (although I enabled 
Constants.Configuration.ENABLE_REST_THROUGH_GET) uses HTTP POST for the 
request.

Can anybody tell me how I enable REST GET in the client (or if it is 
even supported) ?

regards,
philipp



-- 
Philipp Wolfgang Leitner, Bakk.rer.soc.oec.
0225511
Vienna University of Technology

" A programmer is a person who passes as an exacting expert on the basis of
being able to turn out, after innumerable punching, an infinite series of
incomprehensible answers calculated with micrometric precisions from vague
assumptions based on debatable figures taken from inconclusive documents
and carried out on instruments of problematical accuracy by persons of
dubious reliability and questionable mentality for the avowed purpose of
annoying and confounding a hopelessly defenseless department that was
unfortunate enough to ask for the information in the first place.
                 -- IEEE Grid newsmagazine "

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: REST over GET support in Java clients?

Posted by Philipp Leitner <ph...@gmx.at>.
Hi Keith,

I have one further question: I noticed that nothing but synchronous 
request-response style invocation seems to be possible with REST enabled 
(no matter whether GET or POST is being used). I reckon this might be a 
limitation of the REST architecture itself (which is AFAIK inherently 
synchronous and request/response oriented).

Is there a way to do fire-and-forget or callback calls in a RESTful way 
using Axis2? Do I need the release candidate for that?

/philipp

keith chapman schrieb:
> Hi Phillip,
>  
> Most of the REST support (including support for PUT and DELETE) was 
> added after the 1.1 release. The REST support in Axis2 mostly emulates 
> the WSDL 2.0 HTTPBinding. The 1.2 release will be out by the end of this 
> month. You can use the 1.2 Release candidate for the moment.
>  
> Also some of the properties I mentioned in my previous reply was added 
> after the 1.1 release (eg. MESSAGE_TYPE)
>  
> Thanks,
> Keith.
> 
>  
> On 4/16/07, *Philipp Leitner* <philipp.leitner@gmx.at 
> <ma...@gmx.at>> wrote:
> 
>     I am currently at version 1.1.1 . Do you think that I should upgrade to
>     a more recent version?
> 
>     /philipp
> 
>     keith chapman schrieb:
>      > Hi Philipp,
>      >
>      > I guess the parameter ENABLE_REST_THROUGH_GET is not used
>     anymore. Yes
>      > Axis2 supports REST. BTW which version are you using?
>      >
>      > The following applies if you are using the nightlies or the 1.2
>     Release
>      > candidate.
>      >
>      > Hope I answered your question...
>      >
>      > See comments inline
>      >
>      > On 4/16/07, *Philipp Leitner* <philipp.leitner@gmx.at
>     <ma...@gmx.at>
>      > <mailto:philipp.leitner@gmx.at <ma...@gmx.at>>>
>     wrote:
>      >
>      >     Hi folks,
>      >
>      >     I am wondering if there is support for REST over HTTP GET for
>     Java
>      >     clients in Axis2?
>      >
>      >     I know that there is the configuration parameter
>      >     Constants.Configuration.ENABLE_REST_THROUGH_GET , but so far
>     I  could
>      >     not make it work.
>      >
>      >     I tried something like
>      >
>      >     <snip>
>      >     Options options = new Options();
>      >     options.setTo(new EndpointReference(toEpr));
>      >
>      >
>      > // Not really needed but better have it as it takes care of
>     setting up
>      > default REST rules in case you miss something
>      >
>      >     options.setProperty(Constants.Configuration.ENABLE_REST,
>      >         Constants.VALUE_TRUE );
>      >
>      >
>      >  // Not needed
>      >
>      >    
>     options.setProperty(Constants.Configuration.ENABLE_REST_THROUGH_GET ,
>      >         Constants.VALUE_TRUE);
>      >
>      >
>      >
>      > // Need to add the following bit of code
>      >
>      > // The following will set the httpMethod to use (Supported
>     methods are
>      > GET, PUT, DELETE and POST)
>      >  options.setProperty (Constants.Configuration.HTTP_METHOD,
>      > Constants.Configuration.HTTP_METHOD_GET);
>      >
>      > // Set the relavant contentType (Need to set the messagetype as
>     well as
>      > its needed by the messageFormatters)
>      > // Supported contentTypes are  "application/x-www-form-urlencoded",
>      > "multipart/form-data" and "application/xml";
>      >  options.setProperty (Constants.Configuration.CONTENT_TYPE,
>      > HTTPConstants................................);
>      > options.setProperty(Constants.Configuration.MESSAGE_TYPE,
>      > HTTPConstants................................);
>      >
>      >     ServiceClient sender = new ServiceClient();
>      >     sender.setOptions(options);
>      >     OMElement result = sender.sendReceive(
>      >         OMAbstractFactory.getOMFactory().createOMElement("dummy",
>     null));
>      >     </snip>
>      >
>      >     so far. I figure that the "payload" of an GET request should
>     be null or
>      >     something irrelevant, given that a GET request does not have
>     a body to
>      >     contain any payload?
>      >
>      >     A quick check with tcpmon showed me that this code actually
>     works, but
>      >     still (although I enabled
>      >     Constants.Configuration.ENABLE_REST_THROUGH_GET ) uses HTTP
>     POST for the
>      >     request.
>      >
>      >     Can anybody tell me how I enable REST GET in the client (or
>     if it is
>      >     even supported) ?
>      >
>      >     regards,
>      >     philipp
>      >
>      >
>      >
>      >     --
>      >     Philipp Wolfgang Leitner, Bakk.rer.soc.oec .
>      >     0225511
>      >     Vienna University of Technology
>      >
>      >     " A programmer is a person who passes as an exacting expert
>     on the
>      >     basis of
>      >     being able to turn out, after innumerable punching, an infinite
>      >     series of
>      >     incomprehensible answers calculated with micrometric
>     precisions from
>      >     vague
>      >     assumptions based on debatable figures taken from
>     inconclusive documents
>      >     and carried out on instruments of problematical accuracy by
>     persons of
>      >     dubious reliability and questionable mentality for the avowed
>      >     purpose of
>      >     annoying and confounding a hopelessly defenseless department
>     that was
>      >     unfortunate enough to ask for the information in the first
>     place.
>      >                      -- IEEE Grid newsmagazine "
>      >
>      >    
>     ---------------------------------------------------------------------
>      >     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>      >     <mailto:axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>>
>      >     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>      >     <mailto:axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>>
>      >
>      >
>      > Thanks,
>      > Keith.
>      >
>      > --
>      > Keith Chapman
>      > WSO2 Inc.
>      > Oxygen for Web Services Developers.
>      > http://wso2.org/
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
> 
> 
> 
> 
> -- 
> Keith Chapman
> WSO2 Inc.
> Oxygen for Web Services Developers.
> http://wso2.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: REST over GET support in Java clients?

Posted by keith chapman <ke...@gmail.com>.
Hi Phillip,

Most of the REST support (including support for PUT and DELETE) was added
after the 1.1 release. The REST support in Axis2 mostly emulates the WSDL
2.0 HTTPBinding. The 1.2 release will be out by the end of this month. You
can use the 1.2 Release candidate for the moment.

Also some of the properties I mentioned in my previous reply was added after
the 1.1 release (eg. MESSAGE_TYPE)

Thanks,
Keith.


On 4/16/07, Philipp Leitner <ph...@gmx.at> wrote:
>
> I am currently at version 1.1.1 . Do you think that I should upgrade to
> a more recent version?
>
> /philipp
>
> keith chapman schrieb:
> > Hi Philipp,
> >
> > I guess the parameter ENABLE_REST_THROUGH_GET is not used anymore. Yes
> > Axis2 supports REST. BTW which version are you using?
> >
> > The following applies if you are using the nightlies or the 1.2 Release
> > candidate.
> >
> > Hope I answered your question...
> >
> > See comments inline
> >
> > On 4/16/07, *Philipp Leitner* <philipp.leitner@gmx.at
> > <ma...@gmx.at>> wrote:
> >
> >     Hi folks,
> >
> >     I am wondering if there is support for REST over HTTP GET for Java
> >     clients in Axis2?
> >
> >     I know that there is the configuration parameter
> >     Constants.Configuration.ENABLE_REST_THROUGH_GET , but so far
> I  could
> >     not make it work.
> >
> >     I tried something like
> >
> >     <snip>
> >     Options options = new Options();
> >     options.setTo(new EndpointReference(toEpr));
> >
> >
> > // Not really needed but better have it as it takes care of setting up
> > default REST rules in case you miss something
> >
> >     options.setProperty(Constants.Configuration.ENABLE_REST,
> >         Constants.VALUE_TRUE );
> >
> >
> >  // Not needed
> >
> >     options.setProperty(Constants.Configuration.ENABLE_REST_THROUGH_GET,
> >         Constants.VALUE_TRUE);
> >
> >
> >
> > // Need to add the following bit of code
> >
> > // The following will set the httpMethod to use (Supported methods are
> > GET, PUT, DELETE and POST)
> >  options.setProperty (Constants.Configuration.HTTP_METHOD,
> > Constants.Configuration.HTTP_METHOD_GET);
> >
> > // Set the relavant contentType (Need to set the messagetype as well as
> > its needed by the messageFormatters)
> > // Supported contentTypes are  "application/x-www-form-urlencoded",
> > "multipart/form-data" and "application/xml";
> >  options.setProperty(Constants.Configuration.CONTENT_TYPE,
> > HTTPConstants................................);
> > options.setProperty(Constants.Configuration.MESSAGE_TYPE,
> > HTTPConstants................................);
> >
> >     ServiceClient sender = new ServiceClient();
> >     sender.setOptions(options);
> >     OMElement result = sender.sendReceive(
> >         OMAbstractFactory.getOMFactory().createOMElement("dummy",
> null));
> >     </snip>
> >
> >     so far. I figure that the "payload" of an GET request should be null
> or
> >     something irrelevant, given that a GET request does not have a body
> to
> >     contain any payload?
> >
> >     A quick check with tcpmon showed me that this code actually works,
> but
> >     still (although I enabled
> >     Constants.Configuration.ENABLE_REST_THROUGH_GET ) uses HTTP POST for
> the
> >     request.
> >
> >     Can anybody tell me how I enable REST GET in the client (or if it is
> >     even supported) ?
> >
> >     regards,
> >     philipp
> >
> >
> >
> >     --
> >     Philipp Wolfgang Leitner, Bakk.rer.soc.oec .
> >     0225511
> >     Vienna University of Technology
> >
> >     " A programmer is a person who passes as an exacting expert on the
> >     basis of
> >     being able to turn out, after innumerable punching, an infinite
> >     series of
> >     incomprehensible answers calculated with micrometric precisions from
> >     vague
> >     assumptions based on debatable figures taken from inconclusive
> documents
> >     and carried out on instruments of problematical accuracy by persons
> of
> >     dubious reliability and questionable mentality for the avowed
> >     purpose of
> >     annoying and confounding a hopelessly defenseless department that
> was
> >     unfortunate enough to ask for the information in the first place.
> >                      -- IEEE Grid newsmagazine "
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     For additional commands, e-mail: axis-user-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >
> >
> > Thanks,
> > Keith.
> >
> > --
> > Keith Chapman
> > WSO2 Inc.
> > Oxygen for Web Services Developers.
> > http://wso2.org/
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/

Re: REST over GET support in Java clients?

Posted by Philipp Leitner <ph...@gmx.at>.
I am currently at version 1.1.1 . Do you think that I should upgrade to 
a more recent version?

/philipp

keith chapman schrieb:
> Hi Philipp,
> 
> I guess the parameter ENABLE_REST_THROUGH_GET is not used anymore. Yes 
> Axis2 supports REST. BTW which version are you using?
> 
> The following applies if you are using the nightlies or the 1.2 Release 
> candidate.
> 
> Hope I answered your question...
> 
> See comments inline
> 
> On 4/16/07, *Philipp Leitner* <philipp.leitner@gmx.at 
> <ma...@gmx.at>> wrote:
> 
>     Hi folks,
> 
>     I am wondering if there is support for REST over HTTP GET for Java
>     clients in Axis2?
> 
>     I know that there is the configuration parameter
>     Constants.Configuration.ENABLE_REST_THROUGH_GET , but so far I  could
>     not make it work.
> 
>     I tried something like
> 
>     <snip>
>     Options options = new Options();
>     options.setTo(new EndpointReference(toEpr));
> 
> 
> // Not really needed but better have it as it takes care of setting up 
> default REST rules in case you miss something
> 
>     options.setProperty(Constants.Configuration.ENABLE_REST,
>         Constants.VALUE_TRUE );
> 
> 
>  // Not needed
> 
>     options.setProperty(Constants.Configuration.ENABLE_REST_THROUGH_GET ,
>         Constants.VALUE_TRUE);
> 
> 
> 
> // Need to add the following bit of code
> 
> // The following will set the httpMethod to use (Supported methods are 
> GET, PUT, DELETE and POST)
>  options.setProperty (Constants.Configuration.HTTP_METHOD,   
> Constants.Configuration.HTTP_METHOD_GET);
> 
> // Set the relavant contentType (Need to set the messagetype as well as 
> its needed by the messageFormatters)
> // Supported contentTypes are  "application/x-www-form-urlencoded", 
> "multipart/form-data" and "application/xml";
>  options.setProperty(Constants.Configuration.CONTENT_TYPE,   
> HTTPConstants................................);
> options.setProperty(Constants.Configuration.MESSAGE_TYPE,   
> HTTPConstants................................);
> 
>     ServiceClient sender = new ServiceClient();
>     sender.setOptions(options);
>     OMElement result = sender.sendReceive(
>         OMAbstractFactory.getOMFactory().createOMElement("dummy", null));
>     </snip>
> 
>     so far. I figure that the "payload" of an GET request should be null or
>     something irrelevant, given that a GET request does not have a body to
>     contain any payload?
> 
>     A quick check with tcpmon showed me that this code actually works, but
>     still (although I enabled
>     Constants.Configuration.ENABLE_REST_THROUGH_GET ) uses HTTP POST for the
>     request.
> 
>     Can anybody tell me how I enable REST GET in the client (or if it is
>     even supported) ?
> 
>     regards,
>     philipp
> 
> 
> 
>     --
>     Philipp Wolfgang Leitner, Bakk.rer.soc.oec .
>     0225511
>     Vienna University of Technology
> 
>     " A programmer is a person who passes as an exacting expert on the
>     basis of
>     being able to turn out, after innumerable punching, an infinite
>     series of
>     incomprehensible answers calculated with micrometric precisions from
>     vague
>     assumptions based on debatable figures taken from inconclusive documents
>     and carried out on instruments of problematical accuracy by persons of
>     dubious reliability and questionable mentality for the avowed
>     purpose of
>     annoying and confounding a hopelessly defenseless department that was
>     unfortunate enough to ask for the information in the first place.
>                      -- IEEE Grid newsmagazine "
> 
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <ma...@ws.apache.org>
> 
> 
> Thanks,
> Keith.
> 
> -- 
> Keith Chapman
> WSO2 Inc.
> Oxygen for Web Services Developers.
> http://wso2.org/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: REST over GET support in Java clients?

Posted by keith chapman <ke...@gmail.com>.
Hi Philipp,

I guess the parameter ENABLE_REST_THROUGH_GET is not used anymore. Yes Axis2
supports REST. BTW which version are you using?

The following applies if you are using the nightlies or the 1.2 Release
candidate.

Hope I answered your question...

See comments inline

On 4/16/07, Philipp Leitner <ph...@gmx.at> wrote:
>
> Hi folks,
>
> I am wondering if there is support for REST over HTTP GET for Java
> clients in Axis2?
>
> I know that there is the configuration parameter
> Constants.Configuration.ENABLE_REST_THROUGH_GET , but so far I  could
> not make it work.
>
> I tried something like
>
> <snip>
> Options options = new Options();
> options.setTo(new EndpointReference(toEpr));


// Not really needed but better have it as it takes care of setting up
default REST rules in case you miss something

options.setProperty(Constants.Configuration.ENABLE_REST,
>     Constants.VALUE_TRUE);


 // Not needed

options.setProperty(Constants.Configuration.ENABLE_REST_THROUGH_GET,
>     Constants.VALUE_TRUE);



// Need to add the following bit of code

// The following will set the httpMethod to use (Supported methods are GET,
PUT, DELETE and POST)
 options.setProperty(Constants.Configuration.HTTP_METHOD,
Constants.Configuration.HTTP_METHOD_GET);

// Set the relavant contentType (Need to set the messagetype as well as its
needed by the messageFormatters)
// Supported contentTypes are  "application/x-www-form-urlencoded",
"multipart/form-data" and "application/xml";
 options.setProperty(Constants.Configuration.CONTENT_TYPE,
HTTPConstants................................);
options.setProperty(Constants.Configuration.MESSAGE_TYPE,
HTTPConstants................................);

ServiceClient sender = new ServiceClient();
> sender.setOptions(options);
> OMElement result = sender.sendReceive(
>     OMAbstractFactory.getOMFactory().createOMElement("dummy", null));
> </snip>
>
> so far. I figure that the "payload" of an GET request should be null or
> something irrelevant, given that a GET request does not have a body to
> contain any payload?
>
> A quick check with tcpmon showed me that this code actually works, but
> still (although I enabled
> Constants.Configuration.ENABLE_REST_THROUGH_GET) uses HTTP POST for the
> request.
>
> Can anybody tell me how I enable REST GET in the client (or if it is
> even supported) ?
>
> regards,
> philipp
>
>
>
> --
> Philipp Wolfgang Leitner, Bakk.rer.soc.oec.
> 0225511
> Vienna University of Technology
>
> " A programmer is a person who passes as an exacting expert on the basis
> of
> being able to turn out, after innumerable punching, an infinite series of
> incomprehensible answers calculated with micrometric precisions from vague
> assumptions based on debatable figures taken from inconclusive documents
> and carried out on instruments of problematical accuracy by persons of
> dubious reliability and questionable mentality for the avowed purpose of
> annoying and confounding a hopelessly defenseless department that was
> unfortunate enough to ask for the information in the first place.
>                  -- IEEE Grid newsmagazine "
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
Thanks,
Keith.

-- 
Keith Chapman
WSO2 Inc.
Oxygen for Web Services Developers.
http://wso2.org/