P
Phillip Taylor
Hi guys, I'm looking to develop a simple web service in VB.NET but I'm
having some trivial issues. In Visual Studio I create a web services
project and change the asmx.vb file to this:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
<System.Web.Services.WebService(Namespace:="http://
wwwpreview.#deleted#.co.uk/~ptaylor/Customer.wsdl")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)> _
Public Class CustomerService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function getCustomer() As TreeObject()
Dim t1 As New TreeObject
Dim t2 As New TreeObject
Dim t3 As New TreeObject
Dim arr(2) As TreeObject
arr(0) = t1
arr(1) = t2
arr(2) = t3
Return arr
End Function
End Class
As you can see my function returns an object of type "TreeObject" and
when you run this it works. the clients are clearly returned an array
3 TreeObjects objects. However I cannot actually invoke any functions
on these tree objects. This is the current definition of TreeObject:
Imports System.Web.Services
<System.Serializable()> _
Public Class TreeObject
Public Sub New()
End Sub
<WebMethod()> _
Public Sub setId(ByVal id As Int32)
End Sub
<WebMethod()> _
Public Function getId() As String
Return 1
End Function
<WebMethod()> _
Public Sub setName(ByVal value As String)
End Sub
<WebMethod()> _
Public Function getName() As String
Return "boo ya"
End Function
End Class
However the functions GetName, SetName, GetId, SetId do not appear in
the WSDL file and the functions are not accessable from the client. (I
think TreeObject has no functions other than those inherited from
Object)
How do I make those functions accessible please? Do I need to set up
another "service" or what?
Thanks
Phill
having some trivial issues. In Visual Studio I create a web services
project and change the asmx.vb file to this:
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
<System.Web.Services.WebService(Namespace:="http://
wwwpreview.#deleted#.co.uk/~ptaylor/Customer.wsdl")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)>
_
<ToolboxItem(False)> _
Public Class CustomerService
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function getCustomer() As TreeObject()
Dim t1 As New TreeObject
Dim t2 As New TreeObject
Dim t3 As New TreeObject
Dim arr(2) As TreeObject
arr(0) = t1
arr(1) = t2
arr(2) = t3
Return arr
End Function
End Class
As you can see my function returns an object of type "TreeObject" and
when you run this it works. the clients are clearly returned an array
3 TreeObjects objects. However I cannot actually invoke any functions
on these tree objects. This is the current definition of TreeObject:
Imports System.Web.Services
<System.Serializable()> _
Public Class TreeObject
Public Sub New()
End Sub
<WebMethod()> _
Public Sub setId(ByVal id As Int32)
End Sub
<WebMethod()> _
Public Function getId() As String
Return 1
End Function
<WebMethod()> _
Public Sub setName(ByVal value As String)
End Sub
<WebMethod()> _
Public Function getName() As String
Return "boo ya"
End Function
End Class
However the functions GetName, SetName, GetId, SetId do not appear in
the WSDL file and the functions are not accessable from the client. (I
think TreeObject has no functions other than those inherited from
Object)
How do I make those functions accessible please? Do I need to set up
another "service" or what?
Thanks
Phill