cant add another webmethod :(

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default cant add another webmethod :(

    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 Guest

  2. Similar Questions and Discussions

    1. WebMethod Delay
      Hi, Got a webmethod which call a complex stored procedure on my Sybase Database. Running the procédure from a Query Tool last for 1'30 minute....
    2. How do I get the WebMethodAttribute from within a webmethod?
      I need the description out of the WebMethodAttribute on my web method. I want to be able to throw my own exception and tell it what method threw...
    3. WebMethod returning XMLdataDocument
      Hi all, I am trying to consume a webservice that receives and returns XmlDataDocument , My problem is that the proxy created by VS.Net (by adding...
    4. Webmethod OnEnd
      Hello, I have a requirement on my webservice. I want to track when a request had come to my webmethod and when the response was completed. I...
    5. Pulling DataSet From WebMethod -- Possible?
      Is it possible to have a public WebMethod in a WebService that returns a DataSet? -- _____________________________ Ron Rodenberg Lead Software...
  3. #2

    Default cant add another webmethod :(

    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 Guest

  4. #3

    Default Re: cant add another webmethod :(

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

    /Lasse


    "Christopher Bova" <invalidemail@address.com> wrote in message
    news:b15201c3813a$3e635790$a601280a@phx.gbl...
    > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139