Create request in JSP and handling XML

Discussion in 'Java' started by Pablo, Jan 7, 2007.

  1. Pablo

    Pablo Guest

    Dear all,

    I am trying to do a piece of code for my work but I can´t figure where
    to start from. I need to create a request to a particular URL with some
    parameters that a user gives me and I will send this request to an
    external server that in return will give me an XML file.
    The question is, how do I create such request and how do I get informed
    about the response?

    I have an example in ASP, but I dont what kind of classes would help me
    out.

    Set xml = Server.CreateObject("Microsoft.XMLHTTP")

    xurl="http://externalserver.example.com/?a=fetch&partnerid=" &
    partnerid & "&amount=" & bedrag & "&country=" & var1

    xml.Open "GET", xurl, False

    xml.Send ""

    HTTPReturnCode = xml.status

    x_Result = xml.ResponseText 'this is my XML response file


    Could anyone give me some pointers?

    Thanks,
    P.
     
    Pablo, Jan 7, 2007
    #1
    1. Advertising

  2. Pablo

    Daniel Pitts Guest

    Pablo wrote:
    > Dear all,
    >
    > I am trying to do a piece of code for my work but I can´t figure where
    > to start from. I need to create a request to a particular URL with some
    > parameters that a user gives me and I will send this request to an
    > external server that in return will give me an XML file.
    > The question is, how do I create such request and how do I get informed
    > about the response?
    >
    > I have an example in ASP, but I dont what kind of classes would help me
    > out.
    >
    > Set xml = Server.CreateObject("Microsoft.XMLHTTP")
    >
    > xurl="http://externalserver.example.com/?a=fetch&partnerid=" &
    > partnerid & "&amount=" & bedrag & "&country=" & var1
    >
    > xml.Open "GET", xurl, False
    >
    > xml.Send ""
    >
    > HTTPReturnCode = xml.status
    >
    > x_Result = xml.ResponseText 'this is my XML response file
    >
    >
    > Could anyone give me some pointers?
    >
    > Thanks,
    > P.


    Look up the "URL" class, specifically openConnection or getContents
    methods. Also, look up the jstl "x" tags.
     
    Daniel Pitts, Jan 8, 2007
    #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. Brian Birtle
    Replies:
    2
    Views:
    2,194
    John Saunders
    Oct 16, 2003
  2. Kai Grossjohann
    Replies:
    2
    Views:
    829
    Anton Spaans
    Dec 8, 2003
  3. James Willmore
    Replies:
    4
    Views:
    4,719
    Chris Smith
    Dec 15, 2004
  4. Replies:
    0
    Views:
    4,598
  5. Thea
    Replies:
    2
    Views:
    645
Loading...

Share This Page