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 Michael Lambert <ma...@gmail.com> on 2007/12/22 21:03:36 UTC
restful client support using get
I cannot find a decent example of how to write a REST client using Axis2
and a simple GET statement. Can someone please provide an example or
point me to appropriate documentation. The only example I have found i
uses POST and that doesnt even seem to work (there isnt an empty
constructor for the Call object provided in the sample):
http://ws.apache.org/axis2/0_94/rest-ws.html
I am trying to interface with Googles Geocode API :-/
Thank you!
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: restful client support using get
Posted by Philipp Leitner <ph...@gmx.at>.
With the help of this list I once came up with a client like this:
Options op = new Options();
op.setTo(new EndpointReference(endpoint));
op.setProperty(Constants.Configuration.ENABLE_REST,
Constants.VALUE_TRUE);
op.setProperty (Constants.Configuration.HTTP_METHOD,
Constants.Configuration.HTTP_METHOD_GET);
op.setProperty(Constants.Configuration.CONTENT_TYPE,
HTTPConstants.MEDIA_TYPE_TEXT_XML);
ServiceClient sender = new ServiceClient();
sender.setOptions(op);
OMElement response = sender.sendReceive(null);
// if there's a NPE at that line you
// may need to send some dummy AXIOM object
// instead of null
'endpoint' is a string that contains the URI that you want to retrieve,
including all request parameters and stuff. You need a recent version of
Axis2 for that example to work.
Hope that helps.
/philipp
Michael Lambert schrieb:
> I cannot find a decent example of how to write a REST client using Axis2
> and a simple GET statement. Can someone please provide an example or
> point me to appropriate documentation. The only example I have found i
> uses POST and that doesnt even seem to work (there isnt an empty
> constructor for the Call object provided in the sample):
>
> http://ws.apache.org/axis2/0_94/rest-ws.html
>
> I am trying to interface with Googles Geocode API :-/
>
> Thank you!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org