Web services creation and consumption - java

I'd like to learn how to create a java web service that can be consumed by a web tier, which is constituted of java and flex.
What books can help me learn how to create a java web service and consume it via java & flex?
Should I look to build a web service from scratch or from frameworks like: XFire, Axis, CXF, Spring Web Services, etc.?
If using a framework is recommended, which of the above or any others makes the most sense to learn/use?
EDIT:
Both the java AND flex components of the web tier need to independently access the web service. For example, the flex component helps the user create & save a spreadsheet; the java component retrieves the spreadsheet data and displays it accordingly.

Flex should do the job: Web Services with Flex tutorial

You may not need a web service. Your Flex app can consume Java POJOs directly using Spring and BlazeDS.

What kind of a service are we looking at? If it requires database integration you probably need at least some kind of a framework - you really don't want to be putting your SQL queries hard coded into the app. Spring + Hibernate seems to be one of the most popular choices for a Java server implementation, but both of them are quite massive and require some effort. Appfuse could be something that provides a good starting point for building a service.
Why do you want to do your service with Java anyway? Is this because you know only Java or because there is a Java container already running on your server? I've seen great results with Ruby on Rails too and now there's some buzz about Scala too in the Java world. This could be your chance to try out something new and more flexible ;)

I'll take this opportunity to plug my own book, Eclipse Web Tools Platform: Developing Java Web Applications. Chapter 10 deals exclusively with creating Java Web services. Although the examples are all shown using WTP tooling the lessons discuss Java Web services created with Apache Axis.

Related

NodeJS and Java to create REST API

My company currently has a Java project that allows us to run jobs to process data. The current project has a web interface, but its rather old, and most of the web interface is implemented through Java Servlets by printing HTML out to the web browser.
We want to instead create a REST API using the same core process, and replace the web interface with a different implementation in the future. Then eventually, we may have customers use the REST API.
My question is this: I understand NodeJS is pretty powerful, and from what I've read, makes the most sense when developing a REST API with the JavaScript and JSON integration. Should I attempt to create the REST API with Java, and if so, should I use JavaEE and Glass Fish, or should I have the API be built with NodeJS, then have the NodeJS server call the core Java service to process the requests?
I understand I may be introducing unnecessary complexity, however the project is rather large, and it won't be feasible to port the project over to NodeJS. I don't have experience with REST API creation (or SOAP), so this is new territory for me.
Thanks for the help,
Colby
Your aim is to create REST API so that your customer could use the API.
For this you can use :
NodeJS to create all your complete application code and Rest API.
There are plenty of
Java is good to create Rest API. You can use JEE and server you are comfortable with. For example, GlassFish.
My suggestions : Use Java because your current application is on Java. You could save time because working on same language. You already have skills in Java languages. You can use Spring framework ( Spring MVC, Spring Security and Spring Boot). Theses frameworks offer some great features and are simple to learn.
Since your current application is already in Java, based on Servlets, the easiest way to create a REST API is just to use the JAX-RS API in your current application. You can start with this JAX-RS tutorial. You would probably also want to use JSON-P for converting between Java objects and JSON. GlassFish, Payara, or any other application server should already provide both the API out of the box.
If you want to use plain servlet container, such as Tomcat, you can add Jersey library to our application, which provides a servlet to support the JAX-RS API in the same way. Or you can alternatively use Spring REST to build the REST API.
I don't recommend to use Node.js just for the REST API - it would introduce a new language for a thing, which can just as easily be done with Java, which is already used by your application. In the end, you would still need to connect the additional Node.js application with the current Java app, which is cumbersome. You would probably end up creating a REST interface between the Node.js app and the Java app, making the Node.js app redundant.

Java REST Web Service or .Net Web API

I want to develop a web service.Out of Java web service and .Net Web API which should I select.
.My requirement is that it should be stable and should be effective in performance.Which should bare load of thousands of requests and won't fail.Out of this two which should I choose and why?
My suggestion would be implement Rest WS in Java, Since it's platform independent, rich API's, you can go with Spring for rapid development.
My suggestion is Java. I'm used to Java to build REST server that serve thousands request and it's still working well.
The Jersey is good framework for you. Also Java is open source and independent platform.

Is there any erlang web framework which provides the same functionalities as in Dropwizard framework?

Is there any erlang web framework which provides the same functionalities as in Dropwizard framework? I am not good in erlang and I want to make a website transition from java to erlang.
Yaws's appmod provides everything I need for building web apps. It's beautiful, it's fast, and it's pure Erlang (from a user's point of view). This might sound subjective:) But I think you should give it a try.
Yaws is very well documented and full of examples. There is also a book called Building Web Applications with Erlang: Working with REST and Web Sockets on Yaws which can get you started very quickly.

Integrating .NET application with Java/J2EE app via web services

Assume we have a .NET application that exposes its web services. This app needs to be integrated with our J2EE application running on Weblogic. Both are internal applications so we don't worry too much about security.
There are no really complex data structures/types so we should be able to map them between .NET and Java tier (or at least write adapters on the Java tier to ensure the match).
What is the best approach of consuming these .NET web services in the J2EE application?
The simple approach would be to just generate WSDLs for the .NET web services, and generate Java client classes using wsdl2java or other similar tool and see if that can work without adapters/changes, create unit tests, etc. But in case of data related challenges we may need to deal with XSD/Schemas, generating classes, etc.
I know there is WSIT to deal with interoperability issues, but want to keep this as simple as possible. Any thoughts, ideas?
You could connect the two applications with a RESTful API. This lets them talk in a shared, high level API over HTTP. Both languages have plenty of support for both creating and using HTTP/RESTful services, so this should be fairly simple to implement in either language.

Is it possible to use Enterprise Java Beans in a django project?

I've seen that it is possible to run the django web framework on a GlassFish application server. Is it also possible to use a simple Enterprise Java Bean in a django project which runs on the basis of Jython? My idea is to have a django website for the frontend and Java EE in the backend (to manage the database access, etc.). Does anyone have experience with that?
A possibly easier variant would be to expose the EJB functionality using REST or possibly SOAP to get around interface problems between jython and java rather than do the call directly.

Categories