Hi,
I am trying to use Livelink's Search XML API in VB.NET, in ASP.NET.
I can paste the following query URI in a browser and the search results are returned and displayed in valid, well formed XML in my browser:
However, I want to return the XML and store it in an XML Document in vb.net code behind an aspx page. The code below runs successfully, but the string returned from the http web request is html from a "redirection", instead of the XML search results.
Dim HttpWReq As HttpWebRequest
Dim HttpWResp As HttpWebResponse
Dim ReturnedData As String
Dim srTemp As StreamReader
If Not IsPostBack Then
Dim xmlResults As New XmlDocument()
HttpWReq = CType(WebRequest.Create(" HttpWebRequest)
HttpWReq.Credentials = CredentialCache.DefaultCredentials
'HttpWReq.ContentType = "text/xml"
HttpWReq.Method = "GET"
HttpWResp = CType(HttpWReq.GetResponse(), HttpWebResponse)
If HttpWResp.StatusCode <> HttpStatusCode.OK Then
ReturnedData = New String(""
Else
'xmlResults.Load(HttpWResp.GetResponseStream())
'xmlResults.Save("\\us00011540\junk\test2.txt"
srTemp = New StreamReader(HttpWResp.GetResponseStream())
ReturnedData = srTemp.ReadToEnd()
Dim StreamLength As Int64 = ReturnedData.Length()
If StreamLength > 0 Then
Dim objReader = New StreamWriter("\\server\Junk\test.txt"
objReader.Write(ReturnedData)
objReader.Close()
End If
HttpWResp.Close()
End If
End If
Like I say, the code runs, but ReturnedData ends up being the following:
<HTML>
<!-- File: redirectmeta.html -->
<HEAD>
<TITLE>Livelink - Redirection</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/us_ll9103tst/livelink.exe?func=search&lookfor1=allwords&where1=report&outputformat=xml">
</HEAD>
</HTML>
<!-- End File: redirectmeta.html -->
I'm wanting to get the search results in XML format, as they show up if I paste my URI into a browser.
Any help is appreciated.
BLH
I am trying to use Livelink's Search XML API in VB.NET, in ASP.NET.
I can paste the following query URI in a browser and the search results are returned and displayed in valid, well formed XML in my browser:
http://us7n85/us_ll9103tst/livelink.exe?func=search&lookfor1=allwords&where1=report&outputformat=xml
However, I want to return the XML and store it in an XML Document in vb.net code behind an aspx page. The code below runs successfully, but the string returned from the http web request is html from a "redirection", instead of the XML search results.
Dim HttpWReq As HttpWebRequest
Dim HttpWResp As HttpWebResponse
Dim ReturnedData As String
Dim srTemp As StreamReader
If Not IsPostBack Then
Dim xmlResults As New XmlDocument()
HttpWReq = CType(WebRequest.Create(" HttpWebRequest)
HttpWReq.Credentials = CredentialCache.DefaultCredentials
'HttpWReq.ContentType = "text/xml"
HttpWReq.Method = "GET"
HttpWResp = CType(HttpWReq.GetResponse(), HttpWebResponse)
If HttpWResp.StatusCode <> HttpStatusCode.OK Then
ReturnedData = New String(""
Else
'xmlResults.Load(HttpWResp.GetResponseStream())
'xmlResults.Save("\\us00011540\junk\test2.txt"
srTemp = New StreamReader(HttpWResp.GetResponseStream())
ReturnedData = srTemp.ReadToEnd()
Dim StreamLength As Int64 = ReturnedData.Length()
If StreamLength > 0 Then
Dim objReader = New StreamWriter("\\server\Junk\test.txt"
objReader.Write(ReturnedData)
objReader.Close()
End If
HttpWResp.Close()
End If
End If
Like I say, the code runs, but ReturnedData ends up being the following:
<HTML>
<!-- File: redirectmeta.html -->
<HEAD>
<TITLE>Livelink - Redirection</TITLE>
<META HTTP-EQUIV="Refresh" CONTENT="0; URL=/us_ll9103tst/livelink.exe?func=search&lookfor1=allwords&where1=report&outputformat=xml">
</HEAD>
</HTML>
<!-- End File: redirectmeta.html -->
I'm wanting to get the search results in XML format, as they show up if I paste my URI into a browser.
Any help is appreciated.
BLH