Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Serializable Generic Dictionary - same signature functions err

Status
Not open for further replies.

wmin3

IS-IT--Management
Mar 14, 2008
22
GB
Hi, I am trying to implement two functions in my webservice that are using serializable object:

<WebMethod()> Public Function GetPhotos(ByVal intPropID As Integer) As SerializableDictionary(Of String, Photo)

<WebMethod()> Public Function GetBanners(ByVal intCompID As Integer) As SerializableDictionary(Of String, mBanner)

but I am getting an error. For some reason compiler does not like the fact that signatures for both functions are the same, however, if I was to change the signature from:

<WebMethod()> Public Function GetBanners(ByVal intCompID As Integer) As SerializableDictionary(Of String, mBanner)

to

<WebMethod()> Public Function GetBanners(ByRef intCompID As Integer) As SerializableDictionary(Of String, mBanner)

- (send parameter by refference instead of val) in one of the functions - code compiles no problem.

the compiler error is this:

Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.42]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: There was an error processing 'etCompany.asmx?WSDL'.
- There was an error downloading 'Company.asmx?WSDL'.
- The request failed with the error message:
--
System.InvalidOperationException: The top XML element 'dictionary' from namespac
e ' references distinct types SerializableDictionary`2[Syste
m.String,mBanner] and SerializableDictionary`2[System.String,Photo]. Use XML att
ributes to specify another XML name or namespace for the element or types.
at System.Xml.Serialization.XmlReflectionImporter.ReconcileAccessor(Accessor
accessor, NameTable accessors)
at System.Xml.Serialization.XmlReflectionImporter.ImportElement(TypeModel mod
el, XmlRootAttribute root, String defaultNamespace)
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type
, XmlRootAttribute root, String defaultNamespace)
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type type
, XmlRootAttribute root)
at System.Web.Services.Description.MimeXmlReflector.ReflectReturn()
at System.Web.Services.Description.HttpProtocolReflector.ReflectMimeReturn()
at System.Web.Services.Description.HttpPostProtocolReflector.ReflectMethod()
at System.Web.Services.Description.ProtocolReflector.ReflectBinding(Reflected
Binding reflectedBinding)
at System.Web.Services.Description.ProtocolReflector.Reflect()
at System.Web.Services.Description.ServiceDescriptionReflector.ReflectInterna
l(ProtocolReflector[] reflectors)
at System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type t
ype, String url)
at System.Web.Services.Protocols.DiscoveryServerType..ctor(Type type, String
uri)
at System.Web.Services.Protocols.DiscoveryServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, Http
Context context, HttpRequest request, HttpResponse response, Boolean& abortProce
ssing)

--.

Any ideas?

Code for the imlementation of serializable can be found here:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top