cancel
Showing results for 
Search instead for 
Did you mean: 

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

0 Kudos

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

Accepted Solutions (1)

Accepted Solutions (1)

detlev_beutner
Active Contributor
0 Kudos

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_HowTo...

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!

0 Kudos

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

Answers (0)