cant add another webmethod :(

Discussion in 'ASP .Net Web Services' started by Lasse Edsvik, Sep 22, 2003.

  1. Lasse Edsvik

    Lasse Edsvik Guest

    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
     
    Lasse Edsvik, Sep 22, 2003
    #1
    1. Advertising

  2. 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)...



    >-----Original Message-----
    >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
    >
    >
    >
    >
    >.
    >
     
    Christopher Bova, Sep 22, 2003
    #2
    1. Advertising

  3. Lasse Edsvik

    Lasse Edsvik Guest

    Thanks Christopher, was to blind to see that one :)

    /Lasse


    "Christopher Bova" <> wrote in message
    news:b15201c3813a$3e635790$...
    > 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)...
    >
    >
    >
    > >-----Original Message-----
    > >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
    > >
    > >
    > >
    > >
    > >.
    > >
     
    Lasse Edsvik, Sep 22, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michael Evanchik
    Replies:
    3
    Views:
    466
    Yan-Hong Huang[MSFT]
    Aug 4, 2003
  2. moid
    Replies:
    1
    Views:
    380
    Teemu Keiski
    Jan 26, 2004
  3. Stanley Omega

    Cant find Add New Item > Content Page?

    Stanley Omega, Oct 14, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    351
    Stanley Omega
    Oct 15, 2006
  4. Nagaraj
    Replies:
    1
    Views:
    917
    Lionel B
    Mar 1, 2007
  5. pinky
    Replies:
    2
    Views:
    566
    pinky
    Mar 22, 2006
Loading...

Share This Page