Hello,
We are also using .NET and have all our webservices reference file
inherit from a class that handle a couple of connection problems that
you will experience in .NET. Here is the code for that class
Imports System
Imports System.Net
Imports System.Web.Services
Imports System.Web.Services.Description
Imports System.Web.Services.Protocols
Public Class SoapHttpClientProtocolBase
Inherits SoapHttpClientProtocol
Protected Overrides Function GetWebRequest(ByVal Uri As Uri) As
WebRequest
' The following settings are put in place
' to help avoid connection issues
System.Net.ServicePointManager.Expect100Continue = False
Dim webRequest As HttpWebRequest = CType(MyBase.GetWebRequest
(Uri), HttpWebRequest)
webRequest.KeepAlive = False
Return webRequest
End Function
Protected Overloads Function Invoke(ByVal methodName As String,
ByVal parameters As Object()) As Object()
Dim MAX_CONNECTION_ATTEMPTS As Integer = 6
Dim connectionAttempts As Integer = 0
Dim connectionSucceeded As Boolean = False
Dim invokeReturn As Object() = Nothing
While ((connectionAttempts <= MAX_CONNECTION_ATTEMPTS) And
(Not connectionSucceeded))
Try
connectionAttempts += 1
invokeReturn = MyBase.Invoke(methodName, parameters)
connectionSucceeded = True
Catch ex As WebException
If connectionAttempts >= MAX_CONNECTION_ATTEMPTS Then
Throw ex
End If
End Try
End While
Return invokeReturn
End Function
End Class
You would then use this class as base class for you criterion service
reference class. Example:
Partial Public Class CriterionService
Inherits outletservices.SoapHttpClientProtocolBase
Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
-~----------~----~----~----~------~----~------~--~---