Hi all,
I'm creating a web service to do specific functions within my asp.net application from the client's side.
My question:
How do I create new classes within my web service... If I just use
Public Class Licences
End Class
compile and add a reference to the web service in a windows app, this class doesn't show up. How do I specify these classes and possibly, namespaces?
Also, I see that properties that I create doesn't show... what am I doing wrong?
Some of my service code:
<%@dotnet.itags.org. WebService Language="VB" Class="PtechService" %>
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data.SqlClient
<WebService(Namespace:="http://www.******.com/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class PtechService
Inherits System.Web.Services.WebService
Dim m As New PtechDLL.DBFunctions
Dim DBCon As New SqlConnection(m.DBConnectionstring)
Private Valid As Decimal = Nothing
Private LicenceGUID As String = Nothing
Public ReadOnly Property DaysValid() As String
Get
DaysValid = Valid
End Get
End Property
Public ReadOnly Property LicenceKey() As String
Get
LicenceKey = Licence
End Get
End Property
<WebMethod(Description:="Gets a new licence key for your Intranet Software")> _
Public Function GetLicence(ByRef UserName As String, ByRef Password As String, ByRef ServiceProdKey As String, ByRef LicenceDesription As String) As String
Try
Catch ex As Exception
GetLicence = ex.Message
End Try
End Function
<WebMethod(Description:="")> _
Public Function IsLicenceValid(ByRef LicenceKey As String) As Boolean
End Function
<WebMethod(Description:="")> _
Public Function WhenWillLicenceExpire(ByRef LicenceKey As String) As Date
End Function
End ClassIt's a web service. It's not a class library. You can't just add your own custom classes and expect them to show up in your proxy class.
You can return custom classes if you'd like, but you'd have to make sure they are serialized, and they have to be returned by methods.
Hi Mendhak,
Ok, yeah that's what I wanna do... I got all my methods in seperate code in the site, but alot of these methods are under different classes. and I don't want all my web methods to be in just one "class" in my web service...
All I was asking is, is it possible to specify different classes or namespaces in a webservice, and how to do it...
Any ideas?
Your web methods can reference the classes that you have created in the web service, just as you normally would work with classes in any other application.
The web pages do not need to know of the existence of these custom classes.
The web methods do, so the class definitions should be in the web service project itself.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment