pamsauto
asked on
ASP.net Webservice with Multiple Functions and Custom Types not Working
I have a webservice that has two functions that both return a custom type. If I comment out either function, the webservice works as expected, but if both functions are compliled the first function works fine, but the second gives this error.
System.InvalidOperationExc eption: There was an error generating the XML document. ---> System.InvalidCastExceptio n: Unable to cast object of type ItemsOnInvoiceCollection; to type ;BusinessLogic.PartTypeCol lection;.
He is the simplified code.
System.InvalidOperationExc
He is the simplified code.
<XmlInclude(GetType(BusinessLogic.PartTypeCollection)), XmlInclude(GetType(BusinessLogic.PartType)), XmlInclude(GetType(BusinessLogic.Types.ItemsOnInvoiceCollection)), XmlInclude(GetType(BusinessLogic.Types.ItemsOnInvoice))> _
<WebService(Namespace:="http://barcoding.stcloud.pamsauto.com/webservices/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class ScannerFunctions
Inherits System.Web.Services.WebService
<WebMethod(), XmlInclude(GetType(BusinessLogic.PartTypeCollection)), XmlInclude(GetType(BusinessLogic.PartType))>
Public Function GetGroupedPartData(ByVal GNumber As String, ByVal UserID As String) As BusinessLogic.PartTypeCollection
Dim oEmployee As New Employee(Guid.Parse(UserID))
If oEmployee.HasValue Then
Dim oScannerHandler As New BusinessLogic.ScannerHandler()
Dim parts As New PartTypeCollection
parts.getPartsInAGroup(GNumber)
Dim Info As String = ""
For Each Part As PartType In parts
If oScannerHandler.GetCurrent_DT_WO_INV_PO_AND_ROUTE_ByRNumber(Part.InventoryID, Info, True) Then
Part.extraInfo1 = Info
End If
Next
Return parts
Else
Return Nothing
End If
<WebMethod(), XmlInclude(GetType(BusinessLogic.Types.ItemsOnInvoiceCollection)), XmlInclude(GetType(BusinessLogic.Types.ItemsOnInvoice))>
Public Function GetItemsOnDTOrInvoice(ByVal Number As Integer, ByVal IsADeliveryTicket As Boolean) As BusinessLogic.Types.ItemsOnInvoiceCollection
Dim objReturn As New BusinessLogic.Types.ItemsOnInvoiceCollection
If IsADeliveryTicket Then
objReturn.FillByDTNumber(Number)
Else
objReturn.FillByInvoiceNumber(Number)
End If
Return objReturn
End Function
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Was not the solution, but I figured out the issue off site
ASKER