How to deploy web service on two different system within a LAN? - java

I have created a web service using Netbeans in Fedora which is working fine in local host. But I want to deploy client on different computer and server on different computer.
I could also connect two Fedora systems using a LAN cable(SSH), but could not access the web service.
What is the procedure to deploy it? Does a webDav-http service connection be established? If so how to do that?

To deploy your project in a different machine, compile it, and the copy the war file to the application server you desire. I use Tomcat, just need to copy the war to the webapp folder, you should have something like in glassfish.
About the clients:
What are you using to generate the client? I assume metro, since is the default in netbeans.
Create a new java project;
Add new, Web Service Client;
Create it from the url: something like http://example.com.someService?wsdl.
Changing the ip you change the machine that this client will communicate to.

Related

How to Deploy a Java Web Service in a Private Network

I was able to create a JAVA Rest API Web Service using SpringBoot. How do I deploy it so not only my localhost can access it but other computers in the private LAN as well.
I dont want to officialy publish it outside. Is Glassfish the tool for this?
I want to have an endpoint like
https://privatewebservice.net/api/
in the private network that other people can use.
Thanks.
Deploy the rest on your tomcat server on port 80 and in other PCs in the private LANs update host file for privatewebservice.net to point to your PC's IP in the LAN
It needs to run an a servlet container(aka web server). There are many; Jetty, Tomcat, Glassfish etc. That servlet container will start and host your application and make it available via it's port(s).
You can run this process on any physical or virtual machine that is visible on your LAN. You could even use your own machine for this if it's visible to your LAN (barring firewall/network rules blocking the traffic).
To make it available to your LAN from your machine, find your machines internal LAN IP address (run ifconfig on Linux or ipconfig on Windows) and try accessing the app via that IP from your browser. If other machines on your LAN can see your machine, they should be able to access it too via that IP address (likely you will also have an internal DNS name for your machine which would be cleaner to use in case your IP address changes).
Obviously that's only good for development and testing. Generally for internal hosted applications for your company you would have a machine running somewhere that you could deploy the app to to make it accessible by others on your LAN.
It's worth noting that Spring Boot by default comes with an embedded server/servlet container. By default this is Tomcat, but can be changed to say Jetty, via configuration and changing default dependencies in your maven POM file or Gradle build file. The default will be fine unless you have some specific reason to change it.
To use this embedded server, use one of either Maven or Gradle Spring Boot plugins which will provide a set of tasks that can be used to build an executable Java jar file for the application that will run the application on the embedded server, and the application within it. This can then be run with something like java -jar myapp.jar
Technically speaking this would probably be the easiest way to deploy the application. With the only major requirement on the machine you are deploying to being a compatible version of Java. Although I'd recommend wrapping that app in a Docker image that already has Java on it and use Docker to run the docker image as a container. This means your applications' dependencies(including Java and it's specific version) are housed within the docker image/container and also means the machine that will run the app could host many different applications resource efficiently(RAM, CPU etc), with each managing their own dependencies. The machine hosting the app would then just need Docker installed on it, and doesn't get polluted with any other applications dependencies.
follow this step :
1- generate a war file of your Spring-boot project API - see here how to do
2- deploy it on tomcat server see here how to do
3- replace your localhost with your #adress ip (where the server is on and where the project is deployed)

How do I deploy a runnable jar in Amazon AWS?

I have an android client who sends a sentence to the server. Now this server does some processing and sends the string back to the Android client. I'm using basic client server communication for this, and it is working fine on the local machine. Now I want my server code to be deployed on a server so that I can provide that server address to my client code. The server is not a web app, it's a simple core Java project. As far as I understand, I'll have to deploy it as a runnable jar. But how do I do that using AWS?
Set up apache tomcat and use the deployment endpoint, namely /manager/text/deploy?path=/footoo&war=file:/path/to/foo.war to deploy the war.
If you'd rather deploy a runnable jar, set up an instance, install java on it, and put the jar onto said instance, before going in and using java -jar runnable-foo.jar in a screen session.

How to create a build of webservice cilent for linux server?

I have created web service client on my local machine by referring wsdl file placed in C drive. (JAX-WS) The code is running well on my machine. But the production server is linux machine. Hence i want to create web service client by giving relative path. Can anyone help in this case?
Put your WSDL in the project (hint: src/main/resources/wsdl/).
Use a tool such as Apache CXF to generate the client.
Build the project.
Distribute the built artifacts to various runtime environments - Windows/Linux/Solaris/Whatever.
Have a look at this example: http://qwerky-qwerky.blogspot.co.uk/2011/12/programming-without-programming-1.html

Make web service work on different server

I am developing a web service with Eclipse. This service will be accessed from Android with ksoap2.
I successfully tested the service on my local apache tomcat (http://localhost:8080/) and now want to set this service up on a different server (i.e. http://giraffe/).
The .wsdl file generated by Eclipse contains the following line:
<wsdlsoap:address location="http://localhost:8080/AndroidService/services/AndroidService"/>
I guess this won't work out if I just add the .war file to giraffe and try to reach the service.
My question now is the following: What do I need to change in order to be able to use this service on a different server? Do I just have to change this address location?
If you need me to post some of the code/files, just tell me.
My eclipse project structure looks like this:
You can replace http://localhost:8080 on wsdl with http://giraffe/
Are you facing any issue once you deploy on the server?

deploy java jax ws web service as stand alone server

i am new to webservice. i need your help to understand deployment process.
I have created a new webservice by using following tutorial
http://www.ibm.com/developerworks/webservices/tutorials/ws-eclipse-javase1/section2.html
web service is running fine in eclipse,
right now i am running this service by right clicking on endpoint class and run it as java application. i want to run this service manually because on our server we not going to install eclipse.
You need to bundle your web service implementation classes as jar and you need to deploy to any Java EE complaint servers like JBoss or GlassFish.
You need some web site to host your application. Eclipse is hosting it for you on your local machine but to use manually I assume you mean you want it on a real site?

Categories