|
-
Sep 11th, 2005, 09:10 AM
#1
Can I use web service to host my classes?
My company uses a set of classes for every data access function. The bad part is distributing these dlls with every project that accesses a database. Is there a way to reference these classes in a web service, then have all the applications reference the web service to access the classes?
Here's what I'm trying to do:
VB Code:
Dim WebServ1 as New WebService1
Dim myClass1 as New WebServ1.MyClass1
Dim myClass2 as New WebServ1.MyClass2
Edit: I found this http://msdn.microsoft.com/library/de...SecNetHT15.asp
Is remoting my only option?
Last edited by wild_bill; Sep 11th, 2005 at 09:21 AM.
-
Sep 12th, 2005, 01:57 PM
#2
Re: Can I use web service to host my classes?
Moved to ASP.NET.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Sep 14th, 2005, 05:43 AM
#3
Re: Can I use web service to host my classes?
No, it's actually very simple to use a web service for this. The classes you have for your data access and manipulation function can be referenced in your web service project.
But it won't exactly be the way you're trying to do in your post. Instead you'll need to work with functions (called web methods in context of the web services) and work with the values being returned by it. For example, if you wish to return a class that you've created, you'll need to make sure its serializable. Else you can return the basic .NET types such as datasets, strings, integers, etc.
-
Sep 14th, 2005, 08:11 AM
#4
Re: Can I use web service to host my classes?
Thanks for the reply. Is there a simple test to check if a class is serializable?
-
Sep 14th, 2005, 09:46 AM
#5
Re: Can I use web service to host my classes?
If it is serializable, it'll have the <Serializable()> attribute in its definition 
http://www.c-sharpcorner.com/Code/20...ialization.asp
-
Sep 14th, 2005, 03:29 PM
#6
Re: Can I use web service to host my classes?
Will I have to add WebMethod tags to every function/sub I wish to use inside the class?
-
Sep 15th, 2005, 09:12 AM
#7
Re: Can I use web service to host my classes?
Yes, to every method you want accessible to the outside.
-
Sep 15th, 2005, 09:31 AM
#8
Re: Can I use web service to host my classes?
Here's what I've got so far:
[webservice]
VB Code:
<WebMethod()> _
Public Function GetBusException() As ExceptionBC
Dim exc As New ExceptionBC
End Function
<WebMethod()> _
Public Function GetDalExc() As ExceptionData
Return New ExceptionData
End Function
[/webservice]
[ReferencingProgram]
VB Code:
Dim clsws As wsLCL.Service1
Dim dalExc As wsLCL.ExceptionData = clsws.GetDalExc
Dim busExc As wsLCL.ExceptionBC = clsws.GetBusException
[/ReferencingProgram]
I can view all the public variables and properties, but non of the routines or functions. There are hundreds functions that I wish to access, so adding a web method tag would be a hassle. Is the a way to host an entire class object rather than just the objects inside it?
-
Sep 17th, 2005, 01:44 PM
#9
Re: Can I use web service to host my classes?
Uhm... I'm not sure what you're trying to do, but if you want the class returned, you have to make its definition serializable. It'll be any generic method in your web service which returns this class. Does that make more sense now?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|