Trying to post data to an ASP file

Discussion in 'Java' started by Prasanna, Jul 18, 2003.

  1. Prasanna

    Prasanna Guest

    Hi All,
    I am trying to post data to an ASP file with in IBM's WebSphere
    environment. Can some one tell me why this code is not working. This
    code does not give me any errors, but the data is being posted.

    //mu URL
    String strURL = "http://custcaredev.int.westgroup.com/getRPMAttachment.asp?ReqID=199&ReqEntryID=29483&FName=Attachment.csv";

    System.out.println(" URL = " + strURL);//just printing to console

    URL HoURL = new URL(strURL);
    URLConnection urlc = HoURL.openConnection();
    urlc.setDoInput (true);
    urlc.setDoOutput(true);
    urlc.setUseCaches (false);
    urlc.setRequestProperty("Content-type","application/x-www-form-urlencoded");

    DataOutputStream outSt = new DataOutputStream (urlc.getOutputStream
    ());
    outSt.writeBytes(Fbody); //Fbody is a string. The data to be posted.
    outSt.flush ();
    outSt.close ();
    System.out.println(" End - writing to the URL");

    I tried this code from with in an EJB, and also using a servlet. The
    ASP file did not get the posted data both the situations.

    I appreciate any help in this regard.

    Thanks
    Prasanna
    Prasanna, Jul 18, 2003
    #1
    1. Advertising

  2. Prasanna

    jhking Guest

    The first thing i'd do is make sure your data is formatted correctly.
    There's a tool called curl (http://curl.haxx.se/) that will let send
    gets and posts from a command line.
    Dump your FBody to file and use that file as input to curl, make sure
    everything works from there. If it doesn't fix that.
    Are you by any chance trying to upload a file?
    If you're uploading a file the content type should be
    multipart/form-data IIRC.
    Prasanna wrote:
    > Hi All,
    > I am trying to post data to an ASP file with in IBM's WebSphere
    > environment. Can some one tell me why this code is not working. This
    > code does not give me any errors, but the data is being posted.
    >
    > //mu URL
    > String strURL = "http://custcaredev.int.westgroup.com/getRPMAttachment.asp?ReqID=199&ReqEntryID=29483&FName=Attachment.csv";
    >
    > System.out.println(" URL = " + strURL);//just printing to console
    >
    > URL HoURL = new URL(strURL);
    > URLConnection urlc = HoURL.openConnection();
    > urlc.setDoInput (true);
    > urlc.setDoOutput(true);
    > urlc.setUseCaches (false);
    > urlc.setRequestProperty("Content-type","application/x-www-form-urlencoded");
    >
    > DataOutputStream outSt = new DataOutputStream (urlc.getOutputStream
    > ());
    > outSt.writeBytes(Fbody); //Fbody is a string. The data to be posted.
    > outSt.flush ();
    > outSt.close ();
    > System.out.println(" End - writing to the URL");
    >
    > I tried this code from with in an EJB, and also using a servlet. The
    > ASP file did not get the posted data both the situations.
    >
    > I appreciate any help in this regard.
    >
    > Thanks
    > Prasanna
    jhking, Jul 19, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Vishal
    Replies:
    1
    Views:
    655
    Steve C. Orr [MVP, MCSD]
    Dec 21, 2004
  2. =?Utf-8?B?Z29yaWxsYQ==?=
    Replies:
    1
    Views:
    757
    Masudur
    May 25, 2007
  3. Hal Vaughan
    Replies:
    4
    Views:
    776
    Hal Vaughan
    Jan 14, 2008
  4. JT

    post data, then post again..

    JT, Sep 5, 2003, in forum: ASP General
    Replies:
    1
    Views:
    134
    Bite My Bubbles
    Sep 6, 2003
  5. J. Muenchbourg
    Replies:
    0
    Views:
    349
    J. Muenchbourg
    Aug 6, 2003
Loading...

Share This Page