navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

Complicated ASP Call

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> Complicated ASP Call
Page: [1]
 
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
Complicated ASP Call - 8/7/2006 17:38:06   
I have no idea if this can be done... But this is what I want to try to do.

I want to send a request from one web server to another secure webserver, which accesses an oracle database function and then send info back to the original web server.

THis is what I am thinking, but do not know how to execute it:

so we got 2 web servers:

Web Server 1 (Not Secure)
Web Server 2 (Secure)

So on Web Server 1 I am writing an ASP script. In this script I want to send out a request to Web Server 2 like this maybe: (https://www.test.ca/ts.php?id=01). Once it gets here, it executes the the php script or asp, with the id given. This script accesses the oracle database. Then returns the information back to the original web server (Web Server 1)....


Make sense? Please do not ask why this is being done. This is the only way I can see doing this. Can anyone help with this?>

Thanks
rage
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Complicated ASP Call - 8/7/2006 17:56:47   
As you are using asp, both servers are MS?
You could use ServerXMLHTTP ?

eg, this code on server 1 automatically posts to server 2

<% 
url = "http://www.server2.com/test.asp" 
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "POST", url, false
objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
objHttp.Send "ID=12"
RecordID = objHttp.responseText
set objHttp = nothing
%>


The page test.asp will be used to provide a response based on requesting "ID = 12"

An example test.asp :

<%
If request("ID") = "12" then
response.write "Yes, the answer is 12"
else
response.write "No, the answer was 12"
End if
%>


The objHttp.responseText given to your original code page will be one or the other.
This can be programatically used for further processing





_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/7/2006 18:04:10   
Thanks!

I have no idea what the other server is using right now. I will be finding out tommorrow to be sure.

I will give this a test, and hopefully this is what I need.

If any others have any input, just post...

THanks
rage

(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/7/2006 18:15:34   
Just a few questiosn spooky

Do I need to install anything for this on eithert server?

Then, is this how it works

the first block of code sends the data to the second server. The second script is on the second server. It executes, and sends the response back to objHttp.responseText. Now if i am not mistaken, I could return a HUGE string for: objHttp.responseText correct? Then I could parse this?

I guess the second page could be PHP couldn't it? I mean, you are only opening a page, and telling it to use ID=12 or whatever... so php might work for the second page.


Thanks
rage

(in reply to rage2001)
yogaboy

 

Posts: 377
Joined: 5/22/2004
Status: offline

 
RE: Complicated ASP Call - 8/7/2006 18:27:03   
it doesn't matter what the other server is running as long as it defines some sort of rules for you both to stick to in the xml. They will expose public properties and methods that you can access, and tell you what to send to use them. It will be processed and then sent back to you in the pre-defined form. It most likely will be a long string, and you will use the MS XML DOM.

It's called a web service. They're big in dotNet right now, and you get some Java ones too. Don't hear of it a lot with PHP or ASP.

< Message edited by yogaboy -- 8/7/2006 18:53:50 >

(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/8/2006 17:39:27   
Thanks for the help! Spooky. That worked perfect. Seems to be exactly what I needed! Thanks again.

Steve

(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 9:59:29   
Spookey, got a question. Can't figure something out.

Once, I use the Msxml2.ServerXMLHTTP, I get the data back from the screen and it looks something like this:

Firstname Lastname Middlename Last Term: 200503 - Y

So anyway I parse it quickly like this:

findBreak=instr(RecordID,"Last Term:")
name=Trim(mid(RecordID,1,findBreak-1))
leftover=trim(mid(RecordID,findBreak))

so it will give me Firstname Lastname Middlename for name

Now, here is my problem. If people have a ' or a - in their name, it is going to screw something up on me. So I thought I would try this:

name = Replace(name,"-","")
name = Replace(name,"'","")

When I do this, I get an error in my script for some reason. I get:

Microsoft VBScript runtime error '800a000d'

Type mismatch

I do not understand why. I want ot basically get rid of any - and ' in the name. Can anyone help?

THanks

(in reply to rage2001)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 10:08:47   
quote:

name = Replace(name,"-","")


Have you confirmed you have a valid string there?

Try response.write(name) right before that to be sure there is really something there.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 10:18:39   
Yes there is sometheing there. I can do: response.write name and it works fine. I can also check to see if somethign exists in the string using instr, all that works. The replace just wont work.

(in reply to rage2001)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 10:25:04   
That looks totally fine to me.

How about trying this:

...
name = cstr(name)
name = replace(name,"-","")
...

That any better?

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 17:56:54   
Nope, tried it, didnt work.. I have no idea whats upo with this...

to avoid it for now, I am using:

if instr(name,"-") then
replace(name,"-","")
end if

if instr(name,"'") then
replace(name,"'","")
end if

I do not know if this helps or not... But so far everything passed to name so far, has NOT contained a - or a ' .... they have been just names liek stephen brown ... The type Mismatch error is really confusing me...

so i am assuming now, even though my script works fine for names without - or ' ... it will again not work for names that will contain - or '

(in reply to rage2001)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 18:14:01   
Try renaming it to strName

_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 18:43:14   
I had it called nameString the last time I tried... same prob

I dont understand why the error.. I can check if somethign is in the string... I can do other things... but when I put that in, it doesnt work...


(in reply to rage2001)
Spooky

 

Posts: 26606
Joined: 11/11/1998
From: Middle Earth
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 18:48:24   
How are you actually doing it? Thats not your exact code is it?
eg :

<%
strname= "this-name"

if instr(strname,"-")>0 then
strname= replace(strname,"-","")
end if

response.write strname

%>


_____________________________

If you arent part of the solution, then there is good money to be made prolonging the problem

§þ:)


(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 19:01:57   
like this is what I really don';t understand... as a test, I tested my parsing of the Msxml2.ServerXMLHTTP in a small script. So i took in what I got, which I showed you above, and then I parsed it. Then I realized about the - and ' in their names... so i wrote the replace function.. just like this in my "TEST" script:

stuCombo = "p_input=test"

url = "https://www.test.ca" 
set objHttp = Server.CreateObject("Msxml2.ServerXMLHTTP")
objHttp.open "POST", url, false
objHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" 
objHttp.Send stuCombo
RecordID = objHttp.responseText

if objHttp.status = 200 Then

                if Instr(RecordID, "Invalid ID") then
		response.write "Sorry, invalid info!"
	else
	
		findBreak=instr(RecordID,"Last Term:")
		name=Trim(mid(RecordID,1,findBreak-1))
		leftover=trim(mid(RecordID,findBreak))
		
		name = replace(name,"-","")
		name = replace(name,"'","")
		
		strAryWords = Split(name, " ")
		
		upperBound = Ubound(strAryWords)
		
		firstName = strAryWords(0)
		
		middleName = strAryWords(upperBound)
		
		lastName = strAryWords(1)
		
		strInitial = mid(middleName,1,1)
		
		response.write name & "<br>"
		response.write firstName & "<br>"
		response.write lastName & "<br>"
		response.write middleName & "<br>"
		response.write strInitial & "<br>"
	end if
else
	response.write "Sorry, website down."
end if

set objHttp = nothing


This worked fine!!!! then I placed it in my "actual" project, and that error comes up...

(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/15/2006 19:14:25   
I suppose as a work around I could not use the replace function... I could use something like this:

nameString = "Terri-Lynn O'Quinn"

checkDash = instr(nameString,"-")

if checkDash > 0 then
	nameString = Mid(nameString,1,checkDash-1) & Mid(nameString,checkDash+1,len(nameString))
end if

checkApost = instr(nameString,"'")

if checkApost > 0 then
	nameString = Mid(nameString,1,checkApost-1) & Mid(nameString,checkApost+1,len(nameString))			
end if

response.write nameString

(in reply to rage2001)
rdouglass

 

Posts: 9280
From: Biddeford, ME USA
Status: offline

 
RE: Complicated ASP Call - 8/16/2006 9:23:41   
quote:

then I placed it in my "actual" project, and that error comes up...


Are you using that same variable in other places or any variable at all?

There is absolutely no reason that I can see why the code you posted doesn't work. This leaves some other piece of code external to this a possible suspect.

Taking Spooky's suggestion 1 step further, try renaming *all* the variables you're using here to something else. That will help rule out 'external' variables and values being an issue.

_____________________________

Don't take you're eye off your final destination.

ASP Checkbox Function Tutorial.

(in reply to rage2001)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/16/2006 11:27:02   
Changed them, still getting it. There is no reason to get this error. If the Replace line of code is NOT in there, it works fine in the "actual" project... It is only when the replace line of code is in there, it doesn't work.

Anyways, I think the solution I used above will work. Instead of using replace, I use the Mid function to avoid the ' and - . Wil lsee if that works.

(in reply to rdouglass)
rage2001

 

Posts: 124
Joined: 1/12/2005
Status: offline

 
RE: Complicated ASP Call - 8/20/2006 18:33:01   
The solution I was going to try with the Mid function instead of the Replace worked fine. No errors.

(in reply to rage2001)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> Complicated ASP Call
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts