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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to