473,499 Members | 1,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Microsoft application center test...oResponse.body parsing

Hello everyone,

I am fairly new to MACT, I am currently trying to parse the
oResponse.Body to retrive a dynamic values...store in an array and then
randomly post those values.

Does anyone have any sample code on how to parse the oResponse.Body?

This is what I have so far but I cannot seem to get the value I'm
trying to pick up.
I have been struguling on getting this values for a couple of days now.

The line of source code I'm trying to pickup displays as follows:
<form name="form2" action="/emobile/l.cfm" method="post">
<input type="hidden" name="params"
value="RAND;3928;P_TYPE;0;MYSTATUS;5;AREA;2;SD;0;S EARCH;Search;"/>

I would like to grab value and store it somewhere.

Thanks in advance.

'--------------------------------------------
' Here I'm posting my random search critieria
' and then it will return a page with the results in a form
' of links. The links area property address'
'

Sub SendRequest9()
Dim oConnection, oRequest, oResponse, oHeaders, strStatusCode
If fEnableDelays = True then Test.Sleep (20051)
Set oConnection = Test.CreateConnection(sSiteName, 80, false)
If (oConnection is Nothing) Then
Test.Trace "Error: Unable to create connection to " & sSiteName
Else
Set oRequest = Test.CreateRequest
oRequest.Path = "/emobile/l.cfm"
oRequest.Verb = "POST"
oRequest.HTTPVersion = "HTTP/1.0"
oRequest.EncodeBody = False
set oHeaders = oRequest.Headers
oHeaders.RemoveAll
oHeaders.Add "Accept", "image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
application/vnd.ms-powerpoint, application/msword, */*"
oHeaders.Add "Referer", "http://" & sSiteName &
"/emobile/cr.cfm"
oHeaders.Add "Accept-Language", "en-us"
oHeaders.Add "Content-Type",
"application/x-www-form-urlencoded"
oHeaders.Add "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR
2.0.50215)"
'oHeaders.Add "Host", sSiteName
oHeaders.Add "Host", "(automatic)"
oHeaders.Add "Pragma", "no-cache"
oHeaders.Add "Cookie", "(automatic)"
oHeaders.Add "Content-Length", "(automatic)"
' Test.TraceLevel= -1
oRequest.Body = "rand=8833&p_type=" & GetRandomPropertyType &
"mystatus=" & GetRandomStatus & "area=" & GetRandomArea &
"st=&streetnu"
oRequest.Body = oRequest.Body + "m1=&streetnum2=&zip_code=&lp1=" &
GetRandomPrice1 & "lp2=" & GetRandomPrice2 & "br1=" & GetRandomBed1
oRequest.Body = oRequest.Body + "br2="& GetRandomBed2& "ba1=" &
GetRandomBath1 & "ba2=" & GetRandomBath2 &
"sf1=&sf2=&lsz1=&lsz2=&unt1=&unt2"
oRequest.Body = oRequest.Body + "=&sd=0&Search=Search"
Set oResponse = oConnection.Send(oRequest)
If (oResponse is Nothing) Then
Test.Trace "Error: Failed to receive response for URL to "
+ "/emobile/l.cfm"
Else
strStatusCode = oResponse.ResultCode
End If
oConnection.Close
End If
End Sub
'---------------------
' here I am trying to parse the oResponse.body but get
' nothing using the InStr towards the end of the Sub. I also tried
' the code on the sub above right after the If (oResponse Nothing)
' Then
Else
'Begin params parsing

Sub SendRequest10()
Dim oConnection, oRequest, oResponse, oHeaders, strStatusCode
Dim oUser, Pos1, Pos2, sParams
If fEnableDelays = True then Test.Sleep (287)
Set oConnection = Test.CreateConnection(sSiteName, 80, false)
If (oConnection is Nothing) Then
Test.Trace "Error: Unable to create connection to " & sSiteName
Else
Set oRequest = Test.CreateRequest
Set oUser = Test.GetCurrentUser
oRequest.Path = "/emobile/l.cfm"
oRequest.Verb = "GET"
oRequest.HTTPVersion = "HTTP/1.0"
set oHeaders = oRequest.Headers
oHeaders.RemoveAll
oHeaders.Add "Accept", "*/*"
'Test.Trace("**************************" & oUser.Name & "
RETRIEVING RESULTS**************************")
oHeaders.Add "Referer", "http://" & sSiteName &
"/emobile/l.cfm"
oHeaders.Add "Accept-Language", "en-us"
oHeaders.Add "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0;
Windows NT 5.1; .NET CLR 1.0.3705; .NET CLR 1.1.4322; .NET CLR
2.0.50215)"
'oHeaders.Add "Host", sSiteName
oHeaders.Add "Host", "(automatic)"
oHeaders.Add "Cookie", "(automatic)"
Set oResponse = oConnection.Send(oRequest)
If (oResponse is Nothing) Then
Test.Trace "Error: Failed to receive response for URL to "
+ "/CFIDE/debug/images/topdoc.gif"
Else
'Begin params parsing
If InStr(oResponse.Body, "params") Then
Pos1 = InStr(InStr(oResponse.Body, "params"), oResponse.Body,
"value=")
Pos2 = InStr(Pos1, oResponse.Body, "/>")
sParams = Mid(oResponse.Body, Pos1, Pos2)
Test.Trace "params 2= " & sParams
End If
strStatusCode = oResponse.ResultCode
'Test.Trace "params = " & sParams
End If
oConnection.Close
End If
End Sub

Aug 31 '05 #1
0 2109

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5537
by: 50295 | last post by:
Hi! I'm trying to set the align property/attribute of an IFrame to center but its not working (see below). Can anyone please tell me what's going on, and if there's a work around for this? ...
2
2773
by: Anthony Abbot | last post by:
Hi I have a requirement to use the Application Center Test (part of Visual Studio.Net Enterprise architect) program, to simulate loading on my Web servers. Does anyone know if it is any good? I...
0
1243
by: benh | last post by:
Does anyone have any insight into how Application Center Test handles binary data in a response body? My problem: I need some specific data from inside a PDF file that is coming down as the...
0
421
by: cpavon | last post by:
Hello everyone, I am fairly new to MACT, I am currently trying to parse the oResponse.Body to retrive a dynamic values...store in an array and then randomly post those values. Does anyone...
9
11318
by: AA | last post by:
This is making me crazy!! Please, if some body can help me. I'm testing a ver simple socket client. In my test I just open and close a connection (in a loop) to my local IIS server (port 80)...
3
5861
by: sokolo | last post by:
Hello, I wrote a windows service application however it is not working. The service is supposed to enter a new task every 5 sec within Microsoft Outlook. Here is the code for application: ...
1
3866
by: mudasserrafiq | last post by:
I am using following asp file default.asp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <META http-equiv=Content-Type content="text/html; charset=windows-1252"> <META content="0...
0
823
by: SilentCodingOne | last post by:
I'm creating an application that allows the user to create, edit and begin to post ads to Craiglist. I have everything but the begin to post the ad portion complete and cannot seem to get it to work....
1
3793
by: morrisqueto | last post by:
Hello, One of my websites just started sending a new rare error. The site has been working for almost 2 years without trouble, but today morning started giving away this error in all my views. ...
0
7134
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7012
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7180
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6901
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7392
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4920
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3101
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
307
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.