I am calling Classic ASP Webservices from a .NET application. I have two instances of slow processing of the webservice and fast processing.
The slow way (several seconds at the most) is where I actually read the data returned as such:
Dim oRequestAOCP As WebRequest
Dim oResponseAOCP As HttpWebResponse = Nothing
Dim dataStreamAOCP As Stream = Nothing
Dim readerAOCP As StreamReader = Nothing
Dim responseFromServerAOCP As String
Dim sAOCP = Session("SecureURL") & "/services/rtOrderEntryAOCP.asp"
sAOCP = sAOCP & "?coskey=" & Server.UrlEncode(Session("GUID"))
sAOCP = sAOCP & "&OrderID=" & Server.UrlEncode(Session("OrderID"))
oRequestAOCP = WebRequest.Create(sAOCP)
oRequestAOCP = CType(oRequestAOCP, HttpWebRequest)
oRequestAOCP.Method = "GET"
oResponseAOCP = CType(oRequestAOCP.GetResponse(), HttpWebResponse)
dataStreamAOCP = oResponseAOCP.GetResponseStream()
readerAOCP = New StreamReader(dataStreamAOCP)
responseFromServerAOCP = readerAOCP.ReadToEnd()
Dim xmlAOCP As New XmlDocument()
xmlAOCP.LoadXml(responseFromServerAOCP)
Dim nodeAOCP As XmlNodeList = xmlAOCP.GetElementsByTagName("SUCCESS")
Dim valueAOCP = CBool(nodeAOCP(0).InnerText)
Then, the following is quite fast (sub-second), where I only expect the HTTP status to be returned and nothing else - not a good MO, due to needing data back from webservices in most cases.
Dim oRequest As WebRequest
Dim oResponse As HttpWebResponse = Nothing
Dim oEmail As New Email()
'now, call the webservice to get the AESBlock
Dim strUrl = Session("SecureURL") & "/services/rtOrderEntryStatusUpdate.asp"
strUrl = strUrl & "?GUID=" & Server.UrlEncode(Session("MISCGUID"))
strUrl = strUrl & "&Status=" & Server.UrlEncode(sStatus)
strUrl = strUrl & "&Error=" & Server.UrlEncode(sError)
'make the call to the webservice to prime the order
oRequest = WebRequest.Create(strUrl)
oRequest = CType(oRequest, HttpWebRequest)
oRequest.Method = "GET"
oResponse = CType(oRequest.GetResponse(), HttpWebResponse)
What can I do to speed things up when I need data returned?