I am trying to encapsulate logic within classes, so I have this:
Public Class StolenVehicleTemplate
Private _Make As String
Public Property Make() As String
Get
Make = _Make
End Get
Set(ByVal value As String)
If value = "" Then
ThrowException("E701", "Make cannot be blank")
End If
_Make = value
End Set
End Property
Private Sub ThrowException(ByVal strCode As String, ByVal strMessage As
String)
Dim node As System.Xml.XmlNode =
doc.CreateNode(System.Xml.XmlNodeType.Element, _
SoapException.DetailElementName.Name, _
SoapException.DetailElementName.Namespace)
' Node gets built here
Dim objException As New SoapException("One or more mandatory
elements was not specified", _
SoapException.ClientFaultCode, _
"", _
node)
Throw objException
End Sub
End Class
Whatever I try, I cannot persuade the detail element (node) to appear in the
exception. When I use exactly the same code, but directly within a
webmethod rather than in a class that is referenced from the webmethod, it
all works fine.
Am I missing something? I really want to be able to give the consumer a bit
more detail, without having to define it again and again, every time I use
the class.
John Saunders - 08 Oct 2006 03:14 GMT
>I am trying to encapsulate logic within classes, so I have this:
>
[quoted text clipped - 36 lines]
> bit more detail, without having to define it again and again, every time I
> use the class.
What happens when you use a non-blank actor parameter?
John
Nick Locke - 08 Oct 2006 10:00 GMT
When actor is non-blank, the behaviour is the same.
>>I am trying to encapsulate logic within classes, so I have this:
>>
[quoted text clipped - 40 lines]
>
> John
Nick Locke - 08 Oct 2006 10:01 GMT
When Actor is non-blank, I see the same behaviour.
>>I am trying to encapsulate logic within classes, so I have this:
>>
[quoted text clipped - 40 lines]
>
> John