通过代理服务器连接到Web服务
http://www.codeproject.com/KB/webservices/web_service_by_proxy.aspx
示例代码:
' Search button: do a search, display number of results
Private Sub btnSearch_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSearch.Click
' Create a Google Search object
Dim s As New Google.GoogleSearchService
Try
' google params
Dim strLicenceseKey As String = "google license key" ' google license key
Dim strSearchTerm As String = "Bruno Capuano" ' google license key
' proxy settings
Dim cr As New System.Net.NetworkCredential("user", "pwd", "MyDomain")
Dim pr As New System.Net.WebProxy("127.0.1.2", 80)
pr.Credentials = cr
s.Proxy = pr
' google search
Dim r As Google.GoogleSearchResult = s.doGoogleSearch(strLicenceseKey, _
strSearchTerm, 0, 10, True, "", False, "", "", "")
' Extract the estimated number of results for the search and display it
Dim estResults As Integer = r.estimatedTotalResultsCount
MsgBox(CStr(estResults))
Catch ex As System.Web.Services.Protocols.SoapException
MsgBox(ex.Message)
End Try
End Sub