Soap Fault from within a class - no Detail

Discussion in 'ASP .Net Web Services' started by Nick Locke, Oct 7, 2006.

  1. Nick Locke

    Nick Locke Guest

    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.
     
    Nick Locke, Oct 7, 2006
    #1
    1. Advertising

  2. "Nick Locke" <> wrote in message
    news:...
    >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.



    What happens when you use a non-blank actor parameter?

    John
     
    John Saunders, Oct 8, 2006
    #2
    1. Advertising

  3. Nick Locke

    Nick Locke Guest

    When actor is non-blank, the behaviour is the same.

    "John Saunders" <john.saunders at trizetto.com> wrote in message
    news:...
    > "Nick Locke" <> wrote in message
    > news:...
    >>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.

    >
    >
    > What happens when you use a non-blank actor parameter?
    >
    > John
    >
    >
     
    Nick Locke, Oct 8, 2006
    #3
  4. Nick Locke

    Nick Locke Guest

    When Actor is non-blank, I see the same behaviour.

    "John Saunders" <john.saunders at trizetto.com> wrote in message
    news:...
    > "Nick Locke" <> wrote in message
    > news:...
    >>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.

    >
    >
    > What happens when you use a non-blank actor parameter?
    >
    > John
    >
    >
     
    Nick Locke, Oct 8, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Viv

    Soap fault on Tomcat

    Viv, Nov 5, 2005, in forum: Java
    Replies:
    0
    Views:
    516
  2. Arun Kumar Menon

    Master Detail detail

    Arun Kumar Menon, Aug 6, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    224
    Arun Kumar Menon
    Aug 6, 2003
  3. Frederik Borg

    ASp.net data binding: Master-detail-detail

    Frederik Borg, Jun 9, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    389
    Frederik Borg
    Jun 9, 2006
  4. Ryan Melville

    get custom fault detail type in to wsdl?

    Ryan Melville, Apr 21, 2005, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    209
    Ryan Melville
    Apr 21, 2005
  5. Daniel Berger
    Replies:
    0
    Views:
    124
    Daniel Berger
    Feb 2, 2010
Loading...

Share This Page