Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP & JSP... help 1

Status
Not open for further replies.

medox

Programmer
Feb 28, 2002
21
US
I have two web servers running, one holds an application that stores scanned images and the other is the Web site that displays these images.
Im using ASP and XML to communicate and retrieve data from the image server. The problem is that the Image software provider changed its technology for JSP (it used to be ASP) Tomcat is the web server to support their JSP.

Does anybody know a way to parse the HTML code that returns from the JSP into an ASP page or XML tags? Is that possible? Am I trying to breed apples and oranges?

Thanks,
///edox
 
I am not quite getting what you need here? Do you need to be able to execute JSP and ASP on the same page or just on the same machine?
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Let me try to explain it better... its a weird scenario Im facing here:

There is an application on the Image server that was developed in JSP by a third part company. If you use their web interface, you retrieve a table with a list of images for a particular client.
The major problem is that there are images that some users cannot see (checks, confidential notes, etc), so I need to filter this result before I display it on the client machine.

Unfortunately the image tool doesnt offer more than 1 key to filter these document (in my case I have to use this key to select a particular client)

Their previous engine was developed in ASP, so changing their code and adding XML I was able perform this filter prior displaying results to the client.

So, my question was if there is any way to make this call from my web server (IIS) to their JSP page (JServer) and when it respond as an HTML code, I could (GOD KNOWS HOW) parse the response content and create a new page.

Thanks for your help!
 
Heh, woohoo
Sounds like that company is moving backwards, from ASP and XML to JSP and HTML...

This is possible, but definately not easy or pretty. Do you absolutely have to upgrade to the JSP version? ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Found an easier way than what I was thinking...this may work for you.
This is not a feature it is a hack so be forewarned it works on my server but may not on yours.
We are going to use an XMLHTTP object to request data from your JSP server, when we receive that data back we will then be able to parse the page any which way we please.
Code:
 <%
	Response.Buffer = True
	Dim objXMLHTTP, URL

	' Create an xmlhttp object:
	Set objXMLHTTP = Server.CreateObject(&quot;Microsoft.XMLHTTP&quot;)

	URL = &quot;[URL unfurl="true"]http://www.tek-tips.com/&quot;[/URL]

	' Opens the connection to the remote server.
	objXMLHTTP.Open &quot;GET&quot;, URL, False

	' Actually Sends the request and returns the data:
	objXMLHTTP.Send

	Response.Write &quot;I am now going to display what we received:&quot; & objXMLHTTP.responseText
%>

You can now parse to your hearts content, the first thing I would do is assign the responseText to a variable and then using mid pull out everything between the body tags. Let me know if that works and your still stuck
-Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Hi Again,

Your code works fine if the URL points to an ASP page, when Im trying to point to their JSP server I get a:
...
msxml4.dll error '80072efd'
A connection with the server could not be established
...

I think the java server configuration is causing this error, for instance our IIS internal IP is //10.10.1.18 and to access their pages I need to use //10.10.1.18:8080

Im getting frustrated... anyway, thank you very much for your help (in case you have no more sugestions :eek:)

Thanks,
///edox
..
 
Um, I don't think it's an internal Apache error, I just pointed my script to which is an xml document that is being served out by a Tomcat server (Tomcat, cocoon), it may have something to do with the address specifying a port. Sorry,
Tarwn ------------ My Little Dictionary ---------
Reverse Engineering - The expensive solution to not paying for proper documentation
 
Hi Tarwn,
The code you sent worked fine after a few adjustments in our server. My problem now is:
after this code is executed
...
' Opens the connection to the remote server.
objXMLhttp.Open &quot;GET&quot;, URL, False

' Actually Sends the request and returns the data:
objXMLhttp.Send

Response.Write &quot;I am now going to display what we received:&quot; & objXMLhttp.responseText

the objXML contains the http code that was retrieved from the URL and it will display in the browser with .responseText method.
My question is, do you know any way to parse or check the content of the objXML before I display it?
For example, if the HTML contains a string that says something like &quot;File not found&quot; I can redirect to a different page instead of displaying that one.

Thanks,
///edox
 
Instead of just writing it to the screen you can assign it to a string variable and do whatever type of manipulation you would to. If you do a search in the ASP forum for yahoo and temperature, there was a post not to long ago where someone showed an example of parsing the current temperature from their location directly from a yahoo page.
Basically you will be able to treat it exactly as any other string, so could do checks against common error messages and so on as well as parse the content for certain portions (like a portion of html that always shows up right before your image data).
Feel free to post anything else if you get stuck, i haven't had a good excuse to spend as much time with XMLHTTP object as I would like.
-Tarwn ------------ My Little Dictionary ---------
Extreme Programming - (1)Trying to code before my second cup of coffee. (2) While(1){ Ctrl+C; Ctrl+V; }
FAQ - Web-ese for &quot;Forget Asking Questions, I am to busy&quot; :p
 
or check the xmlhttp obj's state (or is it status) property - roughly equiv i think to the http state e.g. 500 server error, 403 access denied, 404 file not found, etc codestorm
Fire bad. Tree pretty. - Buffy
select * from population where talent > 'average'
You're not a complete programmer unless you know how to guess.
I hope I never consider myself an 'expert'.
<insert witticism here>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top