Is anyone familiar with connecting to the Library of Congress server
http://z3950.loc.gov:7090 to do a search directly via code bypassing the
search form? Based on what I have been able to find about doing this at
http://lcweb.loc.gov/z3950/lcserver.html and other links I can't remember,
it appears that the code below should work for a simple test of connecting
and sending a request. However, it produces a "Bad Request" server error
message. Any suggestions.
What I would really like is the availability of a webservice that would do
this, but reading at http://www.loc.gov/z3950/agency/zing/srw/, seems to
indicate that if you want one you will have to make your own based on their
specifications there. Any insight into how to do this would be appreciated.
Thanks
Try
Dim myWebClient As New System.Net.WebClient
Dim myNameValueCollection As New
System.Collections.Specialized.NameValueCollection
myNameValueCollection.Add("protocolVersion", "Z39.50-1995")
'version 3
myNameValueCollection.Add("options", "present")
myNameValueCollection.Add("preferredMessageSize", "10000")
myNameValueCollection.Add("exceptionalRecordSize", "10000")
Dim uriString As String = "http://140.147.249.38:7090"
'http://z3950.loc.gov:7090
Dim responseArray As Byte() =
myWebClient.UploadValues(uriString, "Post", myNameValueCollection)
' Decode and display the response.
Dim S As String = "Response received was :" &
System.Text.Encoding.ASCII.GetString(responseArray )
MsgBox(S)
Catch ex As Exception
MsgBox(ex.Message)
End Try