I have a pretty basic Web Method (see below) that accepts an arraylist and a
string, and returns an arraylist.
The problem I am running into is that if I send an arraylist containing any
objects, the proxy class breaks saying that type is not expected. In this
case, I am trying to send an arraylist of PSI.Common.Inspection objects.
From what I understand, if I added a XmlArrayItem attribute to the
inspections parameter it would then expect PSI.Common.Inspection objects.
Could anyone let me know if my understanding is correct? If it is, how do I
add the attribute? No matter where I try to place it, I always get a
compiler error.
The web method follows:
<WebMethod(), _
XmlInclude(GetType(PSI.Common.Applicant)), _
XmlInclude(GetType(PSI.Common.ApplicantProperty)), _
XmlInclude(GetType(PSI.Common.Contractor)), _
XmlInclude(GetType(PSI.Common.ContractorType)), _
XmlInclude(GetType(PSI.Common.Inspection)), _
XmlInclude(GetType(PSI.Common.InspectionType)), _
XmlInclude(GetType(PSI.Common.Municipality)), _
XmlInclude(GetType(PSI.Common.Permit)), _
XmlInclude(GetType(PSI.Common.PermitContractor))> _
Public Function SynchronizeClient(ByVal inspections As
System.Collections.ArrayList, ByVal inspectorAccountName As String) As
<XmlArrayItemAttribute(GetType(PSI.Common.Permit)) >
System.Collections.ArrayList
MgrObject.ConnectionString =
ConfigurationSettings.AppSettings("ConnectionStrin g")
Dim str As String = Context.User.Identity.Name
If inspectorAccountName.Length > 0 Then
If mIMgr.CompleteInspections(inspections) <> ErrorCodes.None Then Throw
New System.SystemException("An unknown error occurred while attempting to
synchronize the provided data with the database.")
Return PMgr.GetPermitsForInspector(inspectorAccountName)
End If
End Function
|