Skip to Content

How to send HTTP Post to URL (third party software) in JSP/JSPDynpage

Hello,

we want to integrate a third party application in our Portal Component (JSPDynpage using JSP and HTMLB). This third party component is called like this:

http://servername:port/cgi-bin/cgi.exe?request=map&format=html&swldy_ace=GDF&swldy_image_format=p n g&width=525&height=375

How can we do this in the JSP using HTMLB?

Thanks for your help.

Best regards,

Daniel

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Best Answer
    Posted on Feb 16, 2005 at 09:50 PM

    Hi Daniel,

    if you want to seperately call this application as an iView, for this the application integrator has been built, see https://media.sdn.sap.com/html/submitted_docs/Best_Practices/EP/documentation/How-to_Guides/25_HowToUseAppIntegrator_en.pdf

    Another approach would be an URL iView; on this, there is a switch for GETting or POSTing the parameters, but POST option doesn't seem to work.

    If you really want to include the stuff from your third party app within your own iView, you would have to call it (via http / java) and parse(!) it for it will return a complete html page, when you only want a fragment.

    Second possibility for this case is let HTMLB do the job for you by using NonIsolatedHTMLContainer or IsolatedHTMLContainer.

    Hope it helps

    Detlev

    PS: Please consider rewarding points if it helps. Thanks in advance!

    Add comment
    10|10000 characters needed characters exceeded

    • Hi Detlev,

      thanks for your hint regarding the App. Integrator, but it seemn not to be what we want to do: We call a CGI and get a JEPG Image back as request.

      Now we used the java.net.URLConnection to do the HTTP post in the JSPDynpage:

      ...

      // send HTTP POST

      try {

      u = new URL("http://server/path/ourcgi.exe");

      } catch(MalformedURLException ex) {

      System.err.println("MalformedURLException");

      }

      // build query sting

      String query = "request=plot&format=jpeg&template_name=......."

      int cl = query.length();

      try {

      // open the connection and prepare it to POST

      URLConnection uc = u.openConnection();

      uc.setDoOutput(true);

      uc.setDoInput(true);

      uc.setAllowUserInteraction(false);

      DataOutputStream dos = new DataOutputStream(uc.getOutputStream());

      dos.writeBytes(query);

      dos.close();

      ...

      } catch ...

      Best regards,

      Daniel