Accessing External Web Service

Using the Access MSN Search Web Service button, users can perform a search by making a call to the MSN Search Web Service. To use the MSN Search Web Service, you need to:

  • Add a Web Reference to the project by right clicking on the project name (MyApp) in Solution Explorer and selecting Add Web Reference.

  • Enter "http://soap.search.msn.com/webservices.asmx?wsdl" and click Go to locate the web service.

  • Click Add Reference to create a proxy class to this web service in your project.

The search result returned by the MSN Search Web Service will display in a message box. Code the Access MSN Search Web Service button as follows:

'=================================================== ' Access MSN Search Web Service '=================================================== Private Sub btnMSNWebService_Click( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles btnMSNWebService.Click '---Create a request and response object--- Dim req As New SearchRequest Dim resp As SearchResponse '---Set the request type--- Dim arraySize As Integer = 1 Dim sr(arraySize) As SourceRequest sr(0) = New SourceRequest sr(0).Source = SourceType.Web sr(0).ResultFields = ResultFieldMask.All req.AppID = "B017E1DC4FBB461E67DA0E013AF46CBB4F7BEEA3" req.Query = "ClickOnce" req.CultureInfo = "en-US" req.SafeSearch = com.msn.search.soap.SafeSearchOptions.Strict req.Requests = sr Dim w As New MSNSearchService Try '---Invoke MSN Search Web service--- resp = w.Search(req) Dim resultStr ...

Get Use ClickOnce to Deploy Windows Applications now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.