cant add another webmethod :(

L

Lasse Edsvik

Hello

I have this code:

<%@ WebService language="VB" class="TCPUtil" %>

Imports System
Imports System.Web.Services
Imports System.Xml.Serialization
Imports System.Net

<System.Web.Services.WebService(Namespace
:="http://dotnet.100procent.com/tcp")> _
Public Class TCPUtil

<WebMethod(Description:="Returns a list of IPAdresses for an host")> _
Public Function HostToIPAddresses(ByVal Hostname As String) As
String()

Dim MyHost As IPHostEntry

Dim Addresses() As IPAddress

Dim i As Integer

MyHost = Dns.GetHostByName(Hostname)
Addresses = MyHost.AddressList

Dim AddressString(Addresses.GetUpperBound(0)) As String

For i = 0 To Addresses.GetUpperBound(0)
AddressString(i) = Addresses(i).ToString()
Next

HostToIPAddresses = AddressString
End Function


<WebMethod()>
Public Function Add(ByVal a as Integer, ByVal b as Integer) as Integer
Return a+b
End Function
End Class



and that second is just for testing, but i get:

Compiler Error Message: BC32035: Attribute specifier is not a complete
statement. Use a line continuation to apply the attribute to the following
statement.


on the line <WebMethod()> for the second one, have i forgot something or do
i need so add something?

Best regards
/Lasse
 
C

Christopher Bova

In this case you can take the error message at face value.
Just add the vb line continuation character '_' after
your "WebMethod" attribute. So:

<WebMethod()>_
Public Function Add(ByVal a as Integer, ByVal b as
Integer) as Integer
Return a+b
End Function
End Class

You can also put the attribute and the function
declaration on the same line like so:

<WebMethod()>Public Function Blah(ByVal Foo as Integer)...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top