• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

sending data to servlets running in a different server

 
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I have two applications(WebApplications) running on two different servers.

I want one of my servlet in my application send an xml file to a servlet in other application(running on a different machine).

i can achieve this thing with a POJO having main(String args[]), using some
URL()...stuff..Its working perfectly.

Now i want to connect to that servlet from my servlet. (remember both servlets belong to different applications running on different systems)

I will be very grateful if someone can tell me how to achieve this thing.

Thanks&Regards
Ashok
 
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
To the best of my knowledge i dont know something in the servlet API that should do this stuff. Since you need to send an xml file you can post that file to the url (i.e other servlets url)as if you are uploading a file.
There is nothing in the servlet api to do this. You will have to use something you used in the stand alone java application.
Also apache commons project has the file uploading api, you can use that.

Check this.
http://commons.apache.org/fileupload/using.html

Hope thats helps your cause.

Cheers
 
achayya matta
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Amol,
Its not a problem of UPLOADING..the other servlet gets this XML file and converts it into a PDF file and returns it to my servlet...

Thanks.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HTTP file upload is certainly one way of transferring a file from one machine to another. You could also transport the contents of the file in the body of an HTTP POST request.
 
Amol Nayak
Ranch Hand
Posts: 218
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ya ulf is right,


Hi Amol,
Its not a problem of UPLOADING..the other servlet gets this XML file and converts it into a PDF file and returns it to my servlet...



Ashok, You need to do transformation using xslt, jasper or any other means, or use it for some other purpose that hardly matters and has nothing to do with file uploading. What i suggested is a way to send the xml file from one servlet, to other to do the transformation you need the xml file.
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Ulf suggested ,why not simply send the XML in the body of a HTTP POST request to the other servlet.
You can use Apache's HTTP-Client or URLConnection of core java.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic