0

I need to write a web service in linux, Through a java program. The service provided should be a text file. Say whenever the client access the service, It should return a file say /tmp/sample.txt.

And the problem is, the client is a C# program which is running on the windows 7. And the linux will be running as Virtual machine in Windows.

What I need is:

  1. How can i host a service in linux which is written in java.

  2. How can i access it in windows client whch is a c# program.

I would be happy if anyone help me on this.

Vishal Suthar
  • 17,013
  • 3
  • 59
  • 105
BinaryMee
  • 2,102
  • 5
  • 27
  • 46
  • It sounds like you've already got it figured it out, write the application in Java, run it on Linux. The Windows machine doesn't care what platform it's accessing via a web service, nor does C#. – Nick Veys Mar 12 '13 at 05:27
  • @NickVeys: What steps i need to follow to host it as a service in linux? – BinaryMee Mar 12 '13 at 05:31
  • 1
    Different distributions handle services or daemons differently. To be honest I'd simply Google "custom daemon " and go from there. – Nick Veys Mar 12 '13 at 05:34

2 Answers2

1

You can integrate Tomcat into Apache for hosting Java sites on Linux. Here is the site for Apache Tomcat: http://tomcat.apache.org/. Don't forget you will also need the JDK installed on the Linux server so that it can run Java programs.

Here's a site that can help you get started with it on a RedHat distribution of Linux: http://easylinuxtutorials.blogspot.com.au/2012/07/how-to-install-apache-tomcat-7-on.html

As long as it has an accessible URL, you can just make a call to the URL, then read the file either by saving it to a local directory and reading it off the downloaded file, or directly reading it into a file stream. Check How to read a file from internet?

Community
  • 1
  • 1
0

You mean host a service in Java-WS on Linux! Nothing is "written in Linux"

Here're two pieces which shows...

STEP 1. Create a VM on Fedora/Linux with SFTP so you can upload your Java-ws created (with Netbeans, or a notepad!) on your Windows Workstation to the VM. https://gridwizard.wordpress.com/2014/12/28/install-tomcat-on-fedora-vm-for-msdev/

STEP 2. Create a simple java-ws, put under Tomcat, then consume from C# https://gridwizard.wordpress.com/2014/12/26/java-ws-and-dotnet-interop-example/

Jaye
  • 152
  • 4