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

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

Related

Transferring java application to server

I have created a java application in intellij ide. The application is working well. Now that my application is ready I want to transfer my java application from my machine to server and make it live. I have one server, domain and all the basic rights in the server. Can any one help me figuring out?
I am very new in this part. I dont know anything about hosting my own website and application.
The answer depends on what technology you use. If you use application that needs to be deploy into servlet container you can deploy it onto e.g. Tomcat.
Whatever technology you use you definiately should build your application - it also depends on what building system you use.
E.g.fFor gradle, you can use gradlew build.
For maven: mvn compile.
Tell us more details about technology you use to allow us to help you.
You have a java application (Dropwizard) and first need a server to run it on, which means that it must be a server with java installed or where you can install it yourself.
Then you need to transfer the application "fat" jar (typically you find this in the target directory, depending on how you built it) to this server and start it with java -jar my-application.jar.
Then you need to make sure that the port that the application runs on is available externally. This usually means that you need to have a web server installed (commonly nginx or httpd) which redirects from port 80 or 443 to the port of your application.
Only then is you app "live".

Apache and Tomcat Server Cross Domain

I have three distinct heavily coded web-projects; two of them (new) is newly developed with Java/Script, the other (old) one with PHP. All of these three project has some common resources like HTML containers, Element classes etc. Moreover, one of the Java project is Main Project that call the other two projects.
The issue is that Java projects run on a Tomcat Server, PHP needs to run on Apache Server. And PHP project has some location paths for resources like "../SomeResourceFolder/somePage.php". However, when I run Main Project (Java) on Tomcat Server which has "localhost:8080" I could not reach PHP project which is run on Apache Server with "localhost:80", even if I accomplish to reach PHP project, PHP one fails to reach common resources in Tomcat.
I solve the issue a little bit unconvincing way with JavaBridge and Quercus; they help to run PHP on Tomcat Server. However, again I have some path problems.
Actually these projects runs on production with load-balancer which direct request to related server. I try to simulate this or at least run PHP on Apache, Java on Tomcat and connect them somehow. How can I construct this kind of structure without cross domain problems?
I solve the issue by using "Tomcat Connector". It connect Apache and Tomcat by defining Tomcat as worker, and send HTTP request with given path configuration.
You can follow guide given by Nanyang University. In guide Tomcat 6 and Apache 2.2 are used but I used Tomcat 7 and Apache 2.4 with the same directions.

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 deploy a JSP on to a server other than Tomcat

I am trying to deploy a JSP/servlet onto a server. Not tomcat but on a real web domain. This is my first time doing so and so far I exported it into a war file and placed the file onto the server. Nothing happened which is why I am here. All the google searches seem to concentrate on Tomcat which I have already ran the project on. Advice?
Ok, let's get really basic. You want to see the compiled JSP in a browser, through some public URL, right?
First, find a place to host your application. You can try Digital Ocean (starts at $5/mo), EATJ (free version available), Amazon AWS (free trial available), OpenShift (free gears available), your own computer with dynamic DNS, or many other options available through Google.
Next, you packed your compiled code to a war file. That war file needs to be unpacked (deployed) using some software.
There are numerous ways to handle this (Tomcat, Jetty, Glassfish, etc.). They all have their pros and cons. Pick one and learn the very basics. Tomcat doesn't require a separate web server but you can set one up with it if you like. At this stage, I would keep it simple and not do that yet.
Lastly, set up GoDaddy (or whomever you used to get your URL) to point to the IP address of that server. If your server is running and enough time has passed for the changes to propagate, you should see your page.
There are plenty other J2EE server for example, JBoss and Glassfish. Each one has it's own way to deploy your war files. For example, Glassfish is throught a web administration console (https://docs.oracle.com/cd/E19798-01/821-1757/6nmni99aj/index.html) and in JBoss you need to deploy the war file in a specific directory (http://docs.jboss.org/jbossweb/3.0.x/deployer-howto.html).
It depends on which J2EE server you are using.
Now if you want to get your own server and configure it:
Get the server or VPS
Install JAVA
Install Apache
Install a J2EE server (I prefer glassfish)
Configure glassfish with apache (http://www.codefactorycr.com/glassfish-behind-apache.html) to use apache in front of glassfish
You may want to block the ports 4848 and 8080 used by glassfish
Deploy your webapp
Have fun!!!
PS: I'm assuming you have root access to the server
Easy Apache Tomcat 7 install after,
Run Code via SSH:
/usr/local/cpanel/scripts/addservlets2 --domain=domain.com
For Linux.

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

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.

Categories