Error in MSN Search Service

Rakesh Rao

Member
Joined
Oct 1, 2005
Messages
18
Programming Experience
Beginner
Hey all!

Am using the MSN search web service in my application to collect the resulting urls. But each time i run it prompts for an error: The short description is Client Error.
If i see in details it says an exception has occured in system.web.services.protocols.... and sometimes it says : The underlying connection was timed out etc.
I hav tried a lot but could not found any reasonable answer. Please help me out if some body can.
Here is the code am using.

A lot of thanks in advance.

Imports System.IO
Imports System.Web
Imports System.Net
Imports System.Net.WebClient
Imports System.Web.Services.Protocols
Imports Microsoft.VisualBasic
Imports System.Threading
Public Class Form1
Inherits System.Windows.Forms.Form
#
Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents RichTextBox1 As System.Windows.Forms.RichTextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button
Me.RichTextBox1 = New System.Windows.Forms.RichTextBox
Me.Label1 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(248, 3)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(192, 24)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Search"
'
'RichTextBox1
'
Me.RichTextBox1.Location = New System.Drawing.Point(9, 40)
Me.RichTextBox1.Name = "RichTextBox1"
Me.RichTextBox1.Size = New System.Drawing.Size(928, 448)
Me.RichTextBox1.TabIndex = 1
Me.RichTextBox1.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(512, 3)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(192, 24)
Me.Label1.TabIndex = 2
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(952, 502)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.RichTextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Dim MSN As New MSNSearch.MSNSearchService
Dim Sreq As New MSNSearch.SearchRequest
Dim Srep As New MSNSearch.SearchResponse
Dim Sorep As New MSNSearch.SourceResponse
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Dim arysize As Integer = 1
Dim Soreq(1) As MSNSearch.SourceRequest
Soreq(0) =
New MSNSearch.SourceRequest
Soreq(0).Source = MSNSearch.SourceType.Web
Soreq(0).ResultFields = MSNSearch.ResultFieldMask.Url
Soreq(0).Count = 10
Soreq(0).Offset = 0
Sreq.Query = "link:http://www.sitepill.com"
Sreq.AppID = "ABF50F2519F85CC5BBF40E3A3150AAF5D753B5B2"
Sreq.Requests = Soreq
Sreq.SafeSearch = MSNSearch.SafeSearchOptions.Off
Sreq.CultureInfo = "en-Us"
Try
Srep = MSN.Search(Sreq)
Catch en As Exception
MsgBox(en.ToString)
Exit Sub
End Try
For Each Sorep In Srep.Responses
Dim Res As MSNSearch.Result() = Sorep.Results
Next
Label1.Text = "Total Results Found:" & Sorep.Total.ToString
End Sub
End
Class
 
Back
Top