rest

Alternative to web services in Java

I have this external module of my system and I thought to integrate it with web services. So I wrote the server using annotations (so far so good) and then I used Eclipse (new Web Service Client wizard) to generate the boilerplate code for the client. The result is an ugly bunch of code far from configurable, painful to test and to chang...

How to architecture, design a RESTful device controller?

Hi all, we are planning to develop a device controller for a banking machine. This controller would be embedded directly on the machine, the idea is to use an off the shelf ARM board with Linux for this. We would like to provide the API as a RESTful Web Service. Probably we would have to separate the software on the controller in at le...

REST: Mapping application errors to HTTP Status codes

Is it to be considered good practice to reuse RFC HTTP Status codes like this, or should we be making up new ones that map exactly to our specific error reasons? We're designing a web service API around a couple of legacy applications. In addition to JSON/XML data structures in the Response Body, we aim to return HTTP Status Codes tha...

Cleanest RESTful design for purely "action" calls?

Hello all, I am sticking my toe in the RESTful waters and I just can't find a "satisfactory" solution to how to handle truely "action" oriented calls on a RESTful service? My quandry can be broken down into two parts. 1) Transactional calls: I understand the idea of having an ActionTransactor that you get a resource too with a post...

Trying to call a WCF service with a WebRequest

I have a WCF service that needs to be called by a 3rd party app, posting some raw XML. I am trying to test my service by constructing a simple WebRequest and making the request to the service. Here's my service code: Interface: [ServiceContract(Namespace = "http://test.mydomain.com")] public interface ITest { [WebInvoke(UriTe...

Recommendations for SMS gateways with API-support

I'm building a web application that needs to send notifications by SMS. What SMS gateway service providers with API support fulfill the following requirements: Reliable Global delivery - I will send globally with no specific region being sent to more than others Ideally cheap What are your recommendations? Why? ...

REST best practice: synchronizing a client to a server

I have a REST server and a client application running on a mobile device. The client has some data and would like to get updates to the data from the server. How do I do this in a RESTful way in a single transaction? Suppose the client has the following items: widget id=1 timestamp=2010-03-05T08:00:00 doodad id=1 widget=1 timest...

Why does my Twitter OAuth API call to update status fail, but other calls work?

This is the raw HTTP call that I make to verify authentication. It returns the expected response: GET /1/account/verify_credentials.xml HTTP/1.1 Authorization: OAuth oauth_token="12556442-pndSo1mf2i1ToPSbAyLH4qBBDHmtyutjbvMLckGER",oauth_consumer_key="ih75ityikrTdIwB9kQ",oauth_nonce="6wIbdfxL",oauth_signature_method="HMAC-SHA1",oauth_si...

REST on *just* IIS7 (without a web framework)

Hi, I want to upload files directly to IIS7 (in this case I am using the WebRequest object in .NET). Thus I need IIS7 to accept POST, PUT, and DELETE verbs such that I can upload and delete files on the server directly. Is it possible to have IIS accept files without a a web framework like ASP.NET? Essentially I want to be able to use I...

struts2 rest plugin on google app engine

I am trying to deploy struts2 with the rest plugin onto the Google app engine... I have copied the showcase files to a GAE project created in Eclipse. The compilation and upload works fine. When I hit the index.jsp, which forwards me to /orders I get a 404. When I check the logs, there is no error, just a warning (as below). The Orde...

is restful meant for web services only OR for both web services AND web pages?

I read a lot of Restful tutorials for PHP. (I don't want to go in depth into why I am not using RoR. It is due to the team being more familiar with PHP) Because we are planning for future expansion into having APIs i read that it is important to implement Restful web services. I have looked at tutorials such as http://www.gen-x-des...

How to prevent CSRF in a RESTful application?

Cross Site Request Forgery (CSRF) is typically prevent with one of the following methods: Check referer - RESTful but unreliable insert token into form and store the token in the server session - not really RESTful cryptic one time URIs - not RESTful for the same reason as tokens send password manually for this request (not the cached ...

Centralized Logging for many Java Apps: Syslog vs JMS vs Http vs Local file

Hello, I what all my applications logs to be centralized (ideally in near real-time). We will use a Log4 Appender. Which one should I use: Send log event in a JMS Queue Syslog / syslog-ng Write to a localfile and use rsync (every 3second) to replicate the log Do a POST to a centralized REST Http Service Which one are you using? ...

What Is Wrong With Using GET To Remove Content?

I know it goes against the REST architecture but, from a pragmatic viewpoint, what is wrong about using GET request method to remove data from a database? Let's say I built an application that has an administration panel. In administration panel admins can remove items by accessing URIs like these: /admin-panel/items-controller/remove-...

Bug in Flickr API or is my understanding incorrect?

I'm trying to use the flickr API to get the listing of photos in a pool and so I am using the getPhotos method. I'm only passing in the single mandatory argument of the group ID (in my case "1108839@N25"). The response begins by telling me that there are 19 photos in this response: <?xml version="1.0" encoding="utf-8" ?> <rsp stat="o...

Passing variables to Controller via RESTful routing in Rails

The following question is related to passing a variable from routes to the controller. I have a Ruby on Rails (v 2.3.3) app with one model, which is delivered to the user with multiple views. The current solution involves using multiple controllers which are triggered by multiple routes. For example: ActionController::Routing::Routes.dr...

How do I interact with OData from Java?

OData is Microsoft's repackaging of its Astoria (now WCF Data Services) RESTful query/update protocol. If I want to use Java to create an OData compatible data source, how do I do that? Similarly, if I want to consume an OData data source from Java, how do I do that? http://www.odata.org/ Partial answer below. The OData website sugges...

post xml to Spring REST server returns Unsupported Media Type

I'm trying to create a simple spring based webservice that supports a "post" with xml content. In spring, I define an AnnotationMethodHandler: <bean id="inboundMessageAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> <property name="messageConverters"> <util:list> ...

How to post an XML file using a REST Client in Jersey

I want to send an XML file and receive the response back as an XML file. The code that I am trying throws an exception, please could someone help. I am not sure what is going wrong here ClientConfig config = new DefaultClientConfig(); Client client = Client.create(config); WebResource service = client.resource(getBaseURI()); String resp...

How to map different UI views in a RESTful web application?

Hello, I'm designing a web application, which will support both standard UIs (accessed via browsers) and a RESTful API (an XML/JSON-based web service). User agents will be able to differentiate between these by using different values in the Accept HTTP header. The RESTful API will use the following URI structure (example for an "articl...