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.
Related
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.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I am planning to write a Web Service in Java which connects to a MySQL Database and computes and exposes different information from it.
Then an Android app will connect to this Web Service and process the information.
Initially I thought of using XML files, but I was advised that it is not the best-practice correct way, and the Service part will not be light weight. That I should use JSON.
What is the correct architecture and solution for my problem ?
Also is it possible to run a Java Web Service without Tomcat, directly by the JVM from a jar?
Any documentation or links would be helpful.
yes, for android its better to use JSON, its native API (built in)
and its much lighter.
also , its recommended to use RESTful service, for the same reasons (performance, lighter )
regarding the webservice without tomcat, i am not sure its possible, because you always need a container to manage and run your code.
here is a good tutorial to create RESTful service using Jersy.
http://www.vogella.com/tutorials/REST/article.html
the sample shows data as XML, you can change to JSON.
You can use node.js. This will not require Tomcat or any other application server since it itself hots a HTTP server in itself.
https://blog.nodejitsu.com/a-simple-webservice-in-nodejs/
MySQL with Node.js
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 a problem to connect to an existing WebService (SOAP) through Java generated files from WSDL2Java tool from Axis 1.4.
I've automatically generated the following Java files:
ILIASSoapWebservice.java
ILIASSoapWebserviceBindingStub.java
ILIASSoapWebserviceLocator.java
ILIASSoapWebservicePortType.java
IlOperation.java
IlUserData.java
And now, I can't establish any connection.
How to achieve this to call the RPC's?
As you have already generated the Stubs, you can use the ILIASSoapWebserviceLocator to get a reference to the service and then invoke the operations on the service via the stub.
ILIASSoapWebserviceLocator service = new ILIASSoapWebserviceLocator();
URL portAddress = new URL("http://host:port/yourWebservice" );
ILIASSoapWebservicePortType stub = service.getILIASSoapWebservicePort(portAddress);
stub.<operations>();
You can find here a complete server side and client side web service implementation tutorial on Axis 1.4.
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.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
I have to implement a java component that will work with WSDL, do you aware of any frameworks that will simplify that solution and avoid me to reinvent the wheel (wsdl4j maybe ?)
Here is the basic operations i tend to support (the end user have to do all of these from UI, so there is no way to know in advance the wsdl url in order to generate classes, everything at runtime):
To be able to load a WSDL url so that the server will read its content, provide a list of available methods and know how to activate a web service call.
There shall be a possibility to load a local WSDL file.
In case WSDL url is provided, server shall support http and https formats
To be able to know the required parameters from the WSDL so that I will be able to configure the parameters and activate a web service call let's say on a scheduled base or any other trigger.
After loading the WSDL file I will get a list of required variables and their type
To be able to create an integration point so that I will be able to use this integration point along my applications (persist all these settings and mappings and execute webservice call whenever i need it).
Try Apache CXF, plenty to read on it starting here, also a book, Apache CXF web service development.