' Add the HTTP header Public Function AddHTTPHeader() As Boolean Dim lcName As String = "" Dim lcValue As String = "" Dim loObject(2) As Object Dim loHttpRequestMessageProperty As System.ServiceModel.Channels.HttpRequestMessageProperty = New System.ServiceModel.Channels.HttpRequestMessageProperty() ' Reset the values lSuccess = False ' If we have at least one HTTP header If oHTTPHeader.Count > 0 Then ' For each header For Each loObject In oHTTPHeader ' Initialization lcName = loObject(1) lcValue = loObject(2) ' Add the header loHttpRequestMessageProperty.Headers(lcName) = lcValue Next ' Set the header OperationContext.Current.OutgoingMessageProperties(System.ServiceModel.Channels.HttpRequestMessageProperty.Name) = _ loHttpRequestMessageProperty End If lSuccess = True Return lSuccess End FunctionSo, I thought I would use this:
' Add the HTTP header Public Function AddHTTPHeader() As Boolean Dim lcName As String = "" Dim lcValue As String = "" Dim loObject(2) As Object ' Reset the values lSuccess = False Using loHttpRequestMessageProperty = New System.ServiceModel.Channels.HttpRequestMessageProperty() ' If we have at least one HTTP header If oHTTPHeader.Count > 0 Then ' For each header For Each loObject In oHTTPHeader ' Initialization lcName = loObject(1) lcValue = loObject(2) ' Add the header loHttpRequestMessageProperty.Headers(lcName) = lcValue Next ' Set the header OperationContext.Current.OutgoingMessageProperties(System.ServiceModel.Channels.HttpRequestMessageProperty.Name) = _ loHttpRequestMessageProperty End If End Using lSuccess = True Return lSuccess End FunctionThe designer does not compliant but the run time does with a message: