G
Guest
Hello,
I am developing a web service with the following signature:
Public Function MyFunction(ByVal Contact as ContactDTO) as ContactDTO
When I add this function into my project, I get a 500 Internal Server Error
when I try to access the web service. I believe this is a framework bug?
If I remove the function or remove the parameter, my project works OK.
ContactDTO is a object which is used to transfer data, a couple other
functions use this object but only to return data (not as an input
parameter) and they work OK.
I've seem to have isolated the problem down to two parameters within my
ContactDTO class:
Public Property ContactDestinations() As ContactDestinationDTO()
Get
Return mContactDestination.ToArray
End Get
Private Set(ByVal value As ContactDestinationDTO())
End Set
End Property
Public Property ContactEventDestinations() As
ContactEventDestinationDTO()
Get
Return mContactEventDestination.ToArray
End Get
Private Set(ByVal value As ContactEventDestinationDTO())
End Set
End Property
If I comment out these properties, my code seems to work OK.
So my question is:
1. Why is my web service throwing a 500 Internal Service Error? This seems
to be a framework bug?
2. The ContactDTO works OK as a return parameter, but not as an input
parameter?
3. Why is my web service having problems accepting an object with the two
properties above?
Here is my code:
Public Class ContactDTO
Private mContactID As Nullable(Of Integer)
Private mFirstName As String
Private mLastName As String
Private mLanguageID As Integer
Private mUserID As Nullable(Of Integer)
Private mClient As ClientDTO
Private mDisabled As Boolean
Private mDeleted As Boolean
Private mContactDestination As New List(Of ContactDestinationDTO)
Private mContactEventDestination As New List(Of
ContactEventDestinationDTO)
Public Sub New()
End Sub
Public Sub New(ByVal Contact As ContactEntity)
With Contact
mContactID = .ContactId
mFirstName = .FirstName
mLastName = .LastName
mLanguageID = .LanguageId
mUserID = .UserId
mClient = New ClientDTO(.Client)
mDisabled = .Disabled
mDeleted = .Deleted
For Each ContactDestination As ContactDestinationEntity In
..ContactDestinations
mContactDestination.Add(New ContactDestinationDTO
(ContactDestination))
Next
For Each ContactEventDestination As
ContactEventDestinationEntity In .ContactEventDestinations
mContactEventDestination.Add(New ContactEventDestinationDTO
(ContactEventDestination))
Next
End With
End Sub
Public Property ContactID() As Nullable(Of Integer)
Get
Return mContactID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactID = value
End Set
End Property
Public Property FirstName() As String
Get
Return mFirstName
End Get
Set(ByVal value As String)
mFirstName = value
End Set
End Property
Public Property LastName() As String
Get
Return mLastName
End Get
Set(ByVal value As String)
mLastName = value
End Set
End Property
Public Property LanguageID() As Integer
Get
Return mLanguageID
End Get
Set(ByVal value As Integer)
mLanguageID = value
End Set
End Property
Public Property UserID() As Nullable(Of Integer)
Get
Return mUserID
End Get
Set(ByVal value As Nullable(Of Integer))
mUserID = value
End Set
End Property
Public Property Client() As ClientDTO
Get
Return mClient
End Get
Set(ByVal value As ClientDTO)
mClient = value
End Set
End Property
Public Property Disabled() As Boolean
Get
Return mDisabled
End Get
Set(ByVal value As Boolean)
mDisabled = value
End Set
End Property
Public Property Deleted() As Boolean
Get
Return mDeleted
End Get
Set(ByVal value As Boolean)
mDeleted = value
End Set
End Property
Public Property ContactDestinations() As ContactDestinationDTO()
Get
Return mContactDestination.ToArray
End Get
Private Set(ByVal value As ContactDestinationDTO())
End Set
End Property
Public Property ContactEventDestinations() As
ContactEventDestinationDTO()
Get
Return mContactEventDestination.ToArray
End Get
Private Set(ByVal value As ContactEventDestinationDTO())
End Set
End Property
End Class
Public Class ContactDestinationDTO
Private mContactID As Nullable(Of Integer)
Private mDestinationType As DestinationTypeDTO = Nothing
Private mValue As String
Private mNotificationOrder As Integer
Private mTimeZone As TimeZoneDTO
Private mDisabled As Boolean
Private mContactDestinationSchedules As New List(Of
ContactDestinationScheduleDTO)
Public Sub New()
End Sub
Public Sub New(ByVal ContactDestination As ContactDestinationEntity)
With ContactDestination
mContactID = .ContactId
mDestinationType = New DestinationTypeDTO(.DestinationType)
mValue = .Value
mNotificationOrder = .NotificationOrder
mTimeZone = New TimeZoneDTO(.TimeZone)
mDisabled = .Disabled
For Each Schedule As ContactDestinationScheduleEntity In
ContactDestination.ContactDestinationSchedules
mContactDestinationSchedules.Add(New
ContactDestinationScheduleDTO(Schedule))
Next
End With
End Sub
Public Property ContactID() As Nullable(Of Integer)
Get
Return mContactID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactID = value
End Set
End Property
Public Property DestinationType() As DestinationTypeDTO
Get
Return mDestinationType
End Get
Set(ByVal value As DestinationTypeDTO)
mDestinationType = value
End Set
End Property
Public Property Value() As String
Get
Return mValue
End Get
Set(ByVal value As String)
mValue = value
End Set
End Property
Public Property NotificationOrder() As Integer
Get
Return mNotificationOrder
End Get
Set(ByVal value As Integer)
mNotificationOrder = value
End Set
End Property
Public Property TimeZone() As TimeZoneDTO
Get
Return mTimeZone
End Get
Set(ByVal value As TimeZoneDTO)
mTimeZone = value
End Set
End Property
Public Property Disabled() As Boolean
Get
Return mDisabled
End Get
Set(ByVal value As Boolean)
mDisabled = value
End Set
End Property
Public Property ContactDestinationSchedules() As
ContactDestinationScheduleDTO()
Get
Return mContactDestinationSchedules.ToArray()
End Get
Private Set(ByVal value As ContactDestinationScheduleDTO())
mContactDestinationSchedules.Clear()
mContactDestinationSchedules.AddRange(value)
End Set
End Property
End Class
Public Class ContactDestinationScheduleDTO
Private mContactDestinationScheduleID As Nullable(Of Integer)
Private mContactID As Nullable(Of Integer)
Private mDestinationType As DestinationTypeDTO
Private mContactGroupID As Nullable(Of Integer)
Private mEventID As Nullable(Of Integer)
Private mDayOfWeekID As Integer
Private mStartTime As DateTime
Private mEndTime As DateTime
Private mTimeZone As TimeZoneDTO
Private mDaylightSavingsEnabled As Boolean
Public Sub New()
End Sub
Public Sub New(ByVal ContactDestinationSchedule As
ContactDestinationScheduleEntity)
With ContactDestinationSchedule
mContactDestinationScheduleID = .ContactDestinationScheduleId
mContactID = .ContactId
'mDestinationType = New DestinationTypeDTO(.DestinationType)
mContactGroupID = .ContactGroupId
mEventID = .EventId
mDayOfWeekID = .DayOfWeekId
mStartTime = .StartTime
mEndTime = .EndTime
mTimeZone = New TimeZoneDTO(.TimeZone)
mDaylightSavingsEnabled = .DaylightSavingsEnabled
End With
End Sub
Public Property ContactDestinationScheduleID() As Nullable(Of Integer)
Get
Return mContactDestinationScheduleID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactDestinationScheduleID = value
End Set
End Property
Public Property ContactID() As Nullable(Of Integer)
Get
Return mContactID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactID = value
End Set
End Property
Public Property DestinationType() As DestinationTypeDTO
Get
Return mDestinationType
End Get
Set(ByVal value As DestinationTypeDTO)
mDestinationType = value
End Set
End Property
Public Property ContactGroupID() As Nullable(Of Integer)
Get
Return mContactGroupID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactGroupID = value
End Set
End Property
Public Property EventID() As Nullable(Of Integer)
Get
Return mEventID
End Get
Set(ByVal value As Nullable(Of Integer))
mEventID = value
End Set
End Property
Public Property DayOfWeekID() As Integer
Get
Return mDayOfWeekID
End Get
Set(ByVal value As Integer)
mDayOfWeekID = value
End Set
End Property
Public Property StartTime() As DateTime
Get
Return mStartTime
End Get
Set(ByVal value As DateTime)
mStartTime = value
End Set
End Property
Public Property EndTime() As DateTime
Get
Return mEndTime
End Get
Set(ByVal value As DateTime)
mEndTime = value
End Set
End Property
Public Property TimeZone() As TimeZoneDTO
Get
Return mTimeZone
End Get
Set(ByVal value As TimeZoneDTO)
mTimeZone = value
End Set
End Property
Public Property DaylightSavingsEnabled() As Boolean
Get
Return mDaylightSavingsEnabled
End Get
Set(ByVal value As Boolean)
mDaylightSavingsEnabled = value
End Set
End Property
End Class
Public Class ContactEventDestinationDTO
Private mContactID As Integer
Private mEventID As Integer
Private mDestinationTypeID As Integer
Private mIgnoreSchedules As Boolean
Private mDisabled As Boolean
Public Sub New()
End Sub
Public Sub New(ByVal ContactEventDestination As
ContactEventDestinationEntity)
With ContactEventDestination
mContactID = .ContactId
mEventID = .EventId
mDestinationTypeID = .DestinationTypeId
mIgnoreSchedules = .IgnoreSchedules
mDisabled = .Disabled
End With
End Sub
Public Property ContactID() As Integer
Get
Return mContactID
End Get
Set(ByVal value As Integer)
mContactID = value
End Set
End Property
Public Property EventID() As Integer
Get
Return mEventID
End Get
Set(ByVal value As Integer)
mEventID = value
End Set
End Property
Public Property DestinationTypeID() As Integer
Get
Return mDestinationTypeID
End Get
Set(ByVal value As Integer)
mDestinationTypeID = value
End Set
End Property
Public Property IgnoreSchedules() As Boolean
Get
Return mIgnoreSchedules
End Get
Set(ByVal value As Boolean)
mIgnoreSchedules = value
End Set
End Property
Public Property Disabled() As Boolean
Get
Return mDisabled
End Get
Set(ByVal value As Boolean)
mDisabled = value
End Set
End Property
End Class
I am developing a web service with the following signature:
Public Function MyFunction(ByVal Contact as ContactDTO) as ContactDTO
When I add this function into my project, I get a 500 Internal Server Error
when I try to access the web service. I believe this is a framework bug?
If I remove the function or remove the parameter, my project works OK.
ContactDTO is a object which is used to transfer data, a couple other
functions use this object but only to return data (not as an input
parameter) and they work OK.
I've seem to have isolated the problem down to two parameters within my
ContactDTO class:
Public Property ContactDestinations() As ContactDestinationDTO()
Get
Return mContactDestination.ToArray
End Get
Private Set(ByVal value As ContactDestinationDTO())
End Set
End Property
Public Property ContactEventDestinations() As
ContactEventDestinationDTO()
Get
Return mContactEventDestination.ToArray
End Get
Private Set(ByVal value As ContactEventDestinationDTO())
End Set
End Property
If I comment out these properties, my code seems to work OK.
So my question is:
1. Why is my web service throwing a 500 Internal Service Error? This seems
to be a framework bug?
2. The ContactDTO works OK as a return parameter, but not as an input
parameter?
3. Why is my web service having problems accepting an object with the two
properties above?
Here is my code:
Public Class ContactDTO
Private mContactID As Nullable(Of Integer)
Private mFirstName As String
Private mLastName As String
Private mLanguageID As Integer
Private mUserID As Nullable(Of Integer)
Private mClient As ClientDTO
Private mDisabled As Boolean
Private mDeleted As Boolean
Private mContactDestination As New List(Of ContactDestinationDTO)
Private mContactEventDestination As New List(Of
ContactEventDestinationDTO)
Public Sub New()
End Sub
Public Sub New(ByVal Contact As ContactEntity)
With Contact
mContactID = .ContactId
mFirstName = .FirstName
mLastName = .LastName
mLanguageID = .LanguageId
mUserID = .UserId
mClient = New ClientDTO(.Client)
mDisabled = .Disabled
mDeleted = .Deleted
For Each ContactDestination As ContactDestinationEntity In
..ContactDestinations
mContactDestination.Add(New ContactDestinationDTO
(ContactDestination))
Next
For Each ContactEventDestination As
ContactEventDestinationEntity In .ContactEventDestinations
mContactEventDestination.Add(New ContactEventDestinationDTO
(ContactEventDestination))
Next
End With
End Sub
Public Property ContactID() As Nullable(Of Integer)
Get
Return mContactID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactID = value
End Set
End Property
Public Property FirstName() As String
Get
Return mFirstName
End Get
Set(ByVal value As String)
mFirstName = value
End Set
End Property
Public Property LastName() As String
Get
Return mLastName
End Get
Set(ByVal value As String)
mLastName = value
End Set
End Property
Public Property LanguageID() As Integer
Get
Return mLanguageID
End Get
Set(ByVal value As Integer)
mLanguageID = value
End Set
End Property
Public Property UserID() As Nullable(Of Integer)
Get
Return mUserID
End Get
Set(ByVal value As Nullable(Of Integer))
mUserID = value
End Set
End Property
Public Property Client() As ClientDTO
Get
Return mClient
End Get
Set(ByVal value As ClientDTO)
mClient = value
End Set
End Property
Public Property Disabled() As Boolean
Get
Return mDisabled
End Get
Set(ByVal value As Boolean)
mDisabled = value
End Set
End Property
Public Property Deleted() As Boolean
Get
Return mDeleted
End Get
Set(ByVal value As Boolean)
mDeleted = value
End Set
End Property
Public Property ContactDestinations() As ContactDestinationDTO()
Get
Return mContactDestination.ToArray
End Get
Private Set(ByVal value As ContactDestinationDTO())
End Set
End Property
Public Property ContactEventDestinations() As
ContactEventDestinationDTO()
Get
Return mContactEventDestination.ToArray
End Get
Private Set(ByVal value As ContactEventDestinationDTO())
End Set
End Property
End Class
Public Class ContactDestinationDTO
Private mContactID As Nullable(Of Integer)
Private mDestinationType As DestinationTypeDTO = Nothing
Private mValue As String
Private mNotificationOrder As Integer
Private mTimeZone As TimeZoneDTO
Private mDisabled As Boolean
Private mContactDestinationSchedules As New List(Of
ContactDestinationScheduleDTO)
Public Sub New()
End Sub
Public Sub New(ByVal ContactDestination As ContactDestinationEntity)
With ContactDestination
mContactID = .ContactId
mDestinationType = New DestinationTypeDTO(.DestinationType)
mValue = .Value
mNotificationOrder = .NotificationOrder
mTimeZone = New TimeZoneDTO(.TimeZone)
mDisabled = .Disabled
For Each Schedule As ContactDestinationScheduleEntity In
ContactDestination.ContactDestinationSchedules
mContactDestinationSchedules.Add(New
ContactDestinationScheduleDTO(Schedule))
Next
End With
End Sub
Public Property ContactID() As Nullable(Of Integer)
Get
Return mContactID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactID = value
End Set
End Property
Public Property DestinationType() As DestinationTypeDTO
Get
Return mDestinationType
End Get
Set(ByVal value As DestinationTypeDTO)
mDestinationType = value
End Set
End Property
Public Property Value() As String
Get
Return mValue
End Get
Set(ByVal value As String)
mValue = value
End Set
End Property
Public Property NotificationOrder() As Integer
Get
Return mNotificationOrder
End Get
Set(ByVal value As Integer)
mNotificationOrder = value
End Set
End Property
Public Property TimeZone() As TimeZoneDTO
Get
Return mTimeZone
End Get
Set(ByVal value As TimeZoneDTO)
mTimeZone = value
End Set
End Property
Public Property Disabled() As Boolean
Get
Return mDisabled
End Get
Set(ByVal value As Boolean)
mDisabled = value
End Set
End Property
Public Property ContactDestinationSchedules() As
ContactDestinationScheduleDTO()
Get
Return mContactDestinationSchedules.ToArray()
End Get
Private Set(ByVal value As ContactDestinationScheduleDTO())
mContactDestinationSchedules.Clear()
mContactDestinationSchedules.AddRange(value)
End Set
End Property
End Class
Public Class ContactDestinationScheduleDTO
Private mContactDestinationScheduleID As Nullable(Of Integer)
Private mContactID As Nullable(Of Integer)
Private mDestinationType As DestinationTypeDTO
Private mContactGroupID As Nullable(Of Integer)
Private mEventID As Nullable(Of Integer)
Private mDayOfWeekID As Integer
Private mStartTime As DateTime
Private mEndTime As DateTime
Private mTimeZone As TimeZoneDTO
Private mDaylightSavingsEnabled As Boolean
Public Sub New()
End Sub
Public Sub New(ByVal ContactDestinationSchedule As
ContactDestinationScheduleEntity)
With ContactDestinationSchedule
mContactDestinationScheduleID = .ContactDestinationScheduleId
mContactID = .ContactId
'mDestinationType = New DestinationTypeDTO(.DestinationType)
mContactGroupID = .ContactGroupId
mEventID = .EventId
mDayOfWeekID = .DayOfWeekId
mStartTime = .StartTime
mEndTime = .EndTime
mTimeZone = New TimeZoneDTO(.TimeZone)
mDaylightSavingsEnabled = .DaylightSavingsEnabled
End With
End Sub
Public Property ContactDestinationScheduleID() As Nullable(Of Integer)
Get
Return mContactDestinationScheduleID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactDestinationScheduleID = value
End Set
End Property
Public Property ContactID() As Nullable(Of Integer)
Get
Return mContactID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactID = value
End Set
End Property
Public Property DestinationType() As DestinationTypeDTO
Get
Return mDestinationType
End Get
Set(ByVal value As DestinationTypeDTO)
mDestinationType = value
End Set
End Property
Public Property ContactGroupID() As Nullable(Of Integer)
Get
Return mContactGroupID
End Get
Set(ByVal value As Nullable(Of Integer))
mContactGroupID = value
End Set
End Property
Public Property EventID() As Nullable(Of Integer)
Get
Return mEventID
End Get
Set(ByVal value As Nullable(Of Integer))
mEventID = value
End Set
End Property
Public Property DayOfWeekID() As Integer
Get
Return mDayOfWeekID
End Get
Set(ByVal value As Integer)
mDayOfWeekID = value
End Set
End Property
Public Property StartTime() As DateTime
Get
Return mStartTime
End Get
Set(ByVal value As DateTime)
mStartTime = value
End Set
End Property
Public Property EndTime() As DateTime
Get
Return mEndTime
End Get
Set(ByVal value As DateTime)
mEndTime = value
End Set
End Property
Public Property TimeZone() As TimeZoneDTO
Get
Return mTimeZone
End Get
Set(ByVal value As TimeZoneDTO)
mTimeZone = value
End Set
End Property
Public Property DaylightSavingsEnabled() As Boolean
Get
Return mDaylightSavingsEnabled
End Get
Set(ByVal value As Boolean)
mDaylightSavingsEnabled = value
End Set
End Property
End Class
Public Class ContactEventDestinationDTO
Private mContactID As Integer
Private mEventID As Integer
Private mDestinationTypeID As Integer
Private mIgnoreSchedules As Boolean
Private mDisabled As Boolean
Public Sub New()
End Sub
Public Sub New(ByVal ContactEventDestination As
ContactEventDestinationEntity)
With ContactEventDestination
mContactID = .ContactId
mEventID = .EventId
mDestinationTypeID = .DestinationTypeId
mIgnoreSchedules = .IgnoreSchedules
mDisabled = .Disabled
End With
End Sub
Public Property ContactID() As Integer
Get
Return mContactID
End Get
Set(ByVal value As Integer)
mContactID = value
End Set
End Property
Public Property EventID() As Integer
Get
Return mEventID
End Get
Set(ByVal value As Integer)
mEventID = value
End Set
End Property
Public Property DestinationTypeID() As Integer
Get
Return mDestinationTypeID
End Get
Set(ByVal value As Integer)
mDestinationTypeID = value
End Set
End Property
Public Property IgnoreSchedules() As Boolean
Get
Return mIgnoreSchedules
End Get
Set(ByVal value As Boolean)
mIgnoreSchedules = value
End Set
End Property
Public Property Disabled() As Boolean
Get
Return mDisabled
End Get
Set(ByVal value As Boolean)
mDisabled = value
End Set
End Property
End Class