Starting at Web Service [closed] - java

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to start writing a web service which will most probably using Microsoft SQL for Database.
I am unsure how to start about it since I have never written web service before. I know SQL for database. Java for programming as well but no information regarding web service. I am quick learner and wish to know how shall I start ?
What my project will do is get data from database and post in a front end. I chose Web Service as it uses XML and most compatible with many interfaces.
please guide.

A web service uses a web server as a container to run in. I suggest that you look at Tomcat as a easy but reliable web server. In the Tomcat web server you can make a web service by using jsp and servlets (written in Java).
try having a look at http://www.roseindia.net/jsp/jsp.shtml

You can use the book "OReilly Head First Servlet and JSP" to learn about Web Services in Java.. Thats what i did.

Related

Java to a web service and mysql [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm here to pose a kinda noob question, so please no hate here mates.
The java application I'm trying to create has the following structure.
login request via net Validation(same machine)
**JAVA PROGRAM** ---------------------------------> **WebService** ---------------------------------------> **db**
Response Response
**db** --------------> **WebService** ----------------> **JAVA PROGRAM**
But my doubt is on how to build that webservice.
I've watched several glassfish tutorials, but none of them seem to explain how to actually create this type of connections.
Thank you!
You should divide your problem into several sub-problems and then tackle them one by one. I'm not sure if I understood your setup correctly, but to me it seems like you need the following:
Client Java application and the application logic
Server Java application and the application logic
Database
Connection from the server application to the database
Connection from the client Java application to the server application
In addition, you need to decide what kind of a connection you are going to use between your client and a server. Would it be a SOAP-based web service, a ReST service, plain HTML, just a simple POST/GET, or something else? Also, what kind of frameworks are you using? Spring, perhaps? Wicket? Something else?
Do you have any of those decided or done yet? Feel free to start a new question, I foresee this one being closed in the near future, because it's not clear what you are asking. Do study the What topics can I ask about here? page. If you can show any code in your question, you are much more likely to get answers.
Anyway, to give at least some kind of an answer to your question, I'd use the Spring Framework. Google for spring sql tutorial and then either spring restful web services tutorial, spring servlet tutorial or spring soap web service tutorial based on your technology of choice.
Your database interaction will be same as normal does. You just need to broadcast your Validator class as a WebService.
Below links will help you to do so.
For connecting java class with MySql
For broadcasting your class as Webservice.

How to make java website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to make HTML website of course using CSS etc. But instead of using php for dynamic functions I would like to use Java. I have heard that there are plenty of web frameworks as Spring etc.
The problem is always when I search for tutorial - How to make java web? It shows me results with - web application, applet, servlet, JSP. I can't find short simple answer explaining how to start with that and what is the right thing to start with.
Would you mind telling me what should I use to make what I want? Just some short answer explaining what is what for. I remind you: I want to do some dynamic stuff on web based on Java instead of PHP.
EDIT:
I know I have to use dedicated server with Tomcat probably I am just looking for way to start. Should I start with the framework or?
I personaly only used Thymeleaf tutorials to learn about java-web and I'm satisfied with them, it has good-explained tutorials but it mostly teaches you how to process html templates with java.
If you do not want to follow thymeleaf tutorials, you should search for JAVA EE or JSP tutorials on either google or youtube, both provide well explained video tutorials for beginners
For my webserver I used tomcat which is easy to use and good with debugging. I recommand it
EDIT: A web application may have one or more jsps (java server pages). Servlets are requests from the browser to the jsp.
You must have VPS or Dedicated Server to use, because shared web hostings doesn't support languages like Java, C, C++, Node.JS and so on...

How to write web services with Java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I usually write my web services using PHP + Mysql, in a simplified way: reading the POST/GET params, connecting to the MySQL database and finally printing a JSON.
I'd like to check how to do this with a Java server, I've never programmed Java web servers and I'd like to know what should I study to learn to do it
Thanks
I'm supposing here that you have a good understand of java programming.
Fisrtly, I think you should understand java for web.
I recommend this book:
Head First Servlets and JSP
http://www.amazon.com/Head-First-Servlets-JSP-Certified/dp/0596516681/
Then you can learn web services with java:
Java Web Services: Up and Running
http://www.amazon.com/Java-Web-Services-Up-Running/dp/1449365116
Of course, there are many tutorials over the internet as well, but books give you a lot of background information.
I wanna suggest you garner understanding of the two main WebServices Architectures then decide which ones suit your case/use best
REST (GET,PUT,POST,DELETE,PATCH) JAX-RS
http://docs.oracle.com/javaee/6/tutorial/doc/giepu.html
vs SOAP bases JAX-WS
http://docs.oracle.com/javaee/5/tutorial/doc/bnayn.html
Comparing them:
Main differences between SOAP and RESTful web services in java

Call Axis2 client from spring java application [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I have to call a web service from my web application, and show the response from the web service in my view. Any suggestions?
Thanks in advance
I am using Spring MVC for my web app and Axis2 for the web service.
[EDIT 1]
I was Asking about the posibility to do that since It seemed to me preaty strange to use it that way. (The client generates a web app, so I was like "A web app into another")
You need to generate a client (I suppose you use axis2/soap) using the axis2-tools (wsdl2java). Then you can simply instantiate the client in one of your business logic classes and consume the result.
Using wsdl2java can be quite tedious to run, if you have maven, there is a wsdl2java converter plugin.
Also, I suggest you put the wsdl2java in it's own project, as it should not change regularly.
Spring may be handy to configure the axis server URL and inject a client into your code, but is not required to run the axis2 client.

a single database for 2 apps: desktop and android [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I've searched throw your many posts but I didn't find the answer to my question.
I want to make a project which involves two applications: a desktop one written in java, on the pc and the other in android that will be on a mobile phone. I would like to connect both of the applications to a single database but I don't know were to start it from and how to do it.
Could you give me an example or a hint please? Thank you very much for your time.
I think you want to run your desktop in different PC than the database, if yes, than on the database site you can do a minimal PHP which will be the server with database connection. You can find many php + mysql free hosting. Many php examples are how to receive a GET and a POST parameters, connect to database and return results. Use that server side for serving both mobiles and desktops. So the Communication is via HTTP POST and HTTP GET. Distributed applications like this are used in commercial environments and in school usually you can get a little better note. Google it for keywords implementations. Good luck.

Categories