Results 1 to 4 of 4
  1. #1
    ksur12345 is offline Member
    Join Date
    Jul 2011
    Posts
    7
    Rep Power
    0

    Default Send Data to External System

    I am currently using URL connection to send data to External System. Is there any other way , I can setup a Servlet or something to Send data ?

    URL url =
    new URL(l_URL);
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    OutputStreamWriter wr =
    new OutputStreamWriter(conn.getOutputStream());
    wr.write(data);
    wr.flush();

    The above code is just what I am using in a Helloworld.java. But will a servlet have a way to send data using HTTP Post ? I always that servlet was to just receive data and not sending from it.

    Any other means is also fine. Please let me know

    Thanks
    Sure

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    A sevrlet sits in a servlet container on a web server.
    So yes, it is intended to receive data.
    What it does then is entirely up to the design, so it can send that data elsewhere.

    So. You need to decide where your app is going. If it's not for a web server, then a servlet is no use to you at all.

    What does your "external system" expect?
    What can it accept?
    Those are the parameters you have to work in, which we know nothing about.

  3. #3
    ksur12345 is offline Member
    Join Date
    Jul 2011
    Posts
    7
    Rep Power
    0

    Default

    Thanks Tolls

    The External System just says that "They cannot accept SOAP Message and all the communication hast to be via "HTTP Post" . So I believe we have to use REST service as opposed to SOAP. Currently I already have an Servlet up on my Weblogic Server which receives Data via doPOST method ( not in production) . I am just out of any options except for the URL Connection I mentioned for sending the data

    Please suggest if there are any.
    thanks

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,949
    Rep Power
    19

    Default

    Apache HttpComponents project, specifically the client bit, is another option. But if they need HTTP POST then you'll need to use something that mimics a URL connection. Whether it is Apache or the code you use above.

    Since I have absolutely no idea what your requirements are I can't really make any suggestions beyond that.

Similar Threads

  1. How to send data to webserive
    By rajan701v in forum Android
    Replies: 2
    Last Post: 06-19-2011, 06:37 PM
  2. [Socket] Send audio data
    By Dennis in forum Advanced Java
    Replies: 2
    Last Post: 12-15-2010, 07:31 PM
  3. how to send data to network printer
    By santhosh_el in forum AWT / Swing
    Replies: 3
    Last Post: 10-06-2009, 01:21 PM
  4. WHY j2me app does not send http data?
    By mcapelati in forum CLDC and MIDP
    Replies: 0
    Last Post: 08-10-2009, 04:30 PM
  5. problem data send from network
    By MS_Dark in forum Networking
    Replies: 1
    Last Post: 06-30-2009, 08:32 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •