locked
Turn the DAAB to a web Service .. RRS feed

  • Question

  • User-893040148 posted
    Hi all: I was asked to turn the Database Access Application Block into a web service. I had some problems with that. What i did was : Created an Web service on VS.NET, on asmx file (which i pasted the DAAB), add [webMethod] to the begining of each method with MessageName as one of the property, take off the Static and sealed, etc., add the needed references and namespaces. But I met problems as follows: ---error code Server Error in '/DAABWS' Application. -------------------------------------------------------------------------------- Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NotSupportedException: Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [NotSupportedException: Cannot serialize member System.ComponentModel.Component.Site of type System.ComponentModel.ISite because it is an interface.] System.Xml.Serialization.TypeScope.ImportTypeDesc(Type type, Boolean canBePrimitive, MemberInfo memberInfo) +1282 System.Xml.Serialization.TypeScope.GetTypeDesc(Type type, MemberInfo source, Boolean directReference) +50 System.Xml.Serialization.StructModel.GetPropertyModel(PropertyInfo propertyInfo) +54 System.Xml.Serialization.StructModel.GetFieldModel(MemberInfo memberInfo) +88 System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns) +1531 System.Xml.Serialization.XmlReflectionImporter.ImportStructLikeMapping(StructModel model, String ns) +659 System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, Boolean repeats) +440 [InvalidOperationException: There was an error reflecting type 'System.Data.SqlClient.SqlConnection'.] System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(TypeModel model, String ns, ImportContext context, String dataType, Boolean repeats) +1055 System.Xml.Serialization.XmlReflectionImporter.ImportAccessorMapping(MemberMapping accessor, FieldModel model, XmlAttributes a, String ns, Type choiceIdentifierType) +8242 System.Xml.Serialization.XmlReflectionImporter.ImportMemberMapping(XmlReflectionMember xmlReflectionMember, String ns, XmlReflectionMember[] xmlReflectionMembers) +795 System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) +300 [InvalidOperationException: There was an error reflecting 'connection'.] System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(XmlReflectionMember[] xmlReflectionMembers, String ns, Boolean hasWrapperElement) +604 System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement) +108 System.Web.Services.Protocols.SoapReflector.ImportMembersMapping(XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, Boolean serviceDefaultIsEncoded, Boolean rpc, SoapBindingUse use, SoapParameterStyle paramStyle, String elementName, String elementNamespace, Boolean nsIsDefault, XmlReflectionMember[] members, Boolean validate) +169 System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +1915 [InvalidOperationException: Method DBOBject.RunNonQuery can not be reflected.] System.Web.Services.Protocols.SoapReflector.ReflectMethod(LogicalMethodInfo methodInfo, Boolean client, XmlReflectionImporter xmlImporter, SoapReflectionImporter soapImporter, String defaultNs) +5406 System.Web.Services.Description.SoapProtocolReflector.ReflectMethod() +130 System.Web.Services.Description.ProtocolReflector.ReflectBinding(ReflectedBinding reflectedBinding) +1818 System.Web.Services.Description.ProtocolReflector.Reflect() +506 System.Web.Services.Description.ServiceDescriptionReflector.ReflectInternal(ProtocolReflector[] reflectors) +495 System.Web.Services.Description.ServiceDescriptionReflector.Reflect(Type type, String url) +112 System.Web.Services.Protocols.DocumentationServerType..ctor(Type type, String uri) +158 System.Web.Services.Protocols.DocumentationServerProtocol.Initialize() +268 System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +106 [InvalidOperationException: Unable to handle request.] System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing) +205 System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +82 [InvalidOperationException: Failed to handle request.] System.Web.Services.Protocols.WebServiceHandlerFactory.CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response) +154 System.Web.Services.Protocols.WebServiceHandlerFactory.GetHandler(HttpContext context, String verb, String url, String filePath) +93 System.Web.HttpApplication.MapHttpHandler(HttpContext context, String requestType, String path, String pathTranslated, Boolean useAppConfig) +699 System.Web.MapHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +95 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +173 -------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 ---end of error code I have no idea what i am going to do with it ... Help please ! YL
    Tuesday, February 17, 2004 12:21 PM

All replies

  • User-1038113095 posted
    I dont think you can serialize an DataConnection. And converting the DAAB to a WebService would require this.
    Tuesday, February 17, 2004 4:47 PM
  • User1577934194 posted
    You have to go disconnected if you're using a web service. That means things like DataSets, but NOT DataReaders, which are connected objects and hold open a DB connection. You could turn the DataSet related methods into a WS if you wanted.
    Saturday, April 24, 2004 2:35 PM