0

I am starting a web project in which I would like to have a RESTful Java back-end and a PHP front-end that consumes it (its my first time using REST, although I have a lot of experience with Java and PHP). I have found a few frameworks for this, namely the Guzzle PHP framework, and the Restlet Java framework. Now my question is whether or not I am on the right track. Are there any other technologies you would recommend for this system, or anything else I should take a look at? I'm thinking I wanna use Jetty or Tomcat as the server running the restlet, and normal Apache for the PHP.

Lastly, I would like to know what the advantages/disadvantages of each of the transfer protocols are when it comes to REST. I'm torn between XML and JSON. Any thoughts/links would be appreciated. Thanks!

3 Answers 3

1

For the webservice you can use SOAP and REST. Rest is recently more trendy and easier so it is a good start. You can choose a number of providers for REST

The first three are all using the same Jax-RS standard If you dont like the implementation you can easily switch to an another one. We use CXF extensively and never had a problem with it. Spring is different but also nice if you would use spring anyways.

For the server Jetty and Tomcat are the two main lightweight containers. Jetty is lighter, but to be honest there isnt much performance difference especially with a simple webapp

JSon or XML doesnt matter that much either if you use PHP and Java. Probably JSON is more compact therefore the network traffic will be less, but not significantly. All the above REST providers support both out of the box.

Sign up to request clarification or add additional context in comments.

Comments

1

My 2 cents for the XML vs JSON dilemma. On PHP or Javascript clients I usually prefer JSON because of the handy serialize/deserialize and the notation, as the name implies, was created with Javascript in mind. On the other hand with XML you can use utilities such as JAXB on the server side.

Friends used Restlet with Jetty with good results but I don't have a first hand experience to share.

Good work and good luck

Comments

1

JSON is great for when the client is Javascript because it's simple to convert the response to a Javascript object:

var response = eval('(' + jsonResponse + ')');

I'd recommend the Jersey framework for writing a RESTful web service in Java.

1 Comment

Excellent, I will take a look, Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.