[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Andy Barlow

12/31/2002

I'm trying to get a handle on ASP.Net web services, and am getting nowhere
fast. Any help would be appreciated



To begin with, I created a webservice and uncommented the HelloWorld code
from the example. The file : Service1.asmx is added to my solution:

Imports System.Web.Services

<WebService(Namespace := "http://tempuri....)> _

Public Class Service1

Inherits System.Web.Services.WebService

#Region " Web Services Designer Generated Code "

. . .

#End Region

' WEB SERVICE EXAMPLE

' The HelloWorld() example service returns the string Hello World.

' To build, uncomment the following lines then save and build the
project.

' To test this web service, ensure that the .asmx file is the start page

' and press F5.

'

<WebMethod()> Public Function HelloWorld() As String

HelloWorld = "Hello World"

End Function

End Class





Now, in my client code I have the following:



Dim strSave as string

strSave = HelloWorld()



I have alternatively tried using:



Dim strSave as string

strSave = Service1.HelloWorld()



In each case I get the following:

===========================================================

Compiler Error Message: BC30451: Name 'HelloWorld' is not declared.

Line 87: Dim strSave as string

Line 88:
Line 89: strSave = HelloWorld()
Line 90:
Line 91: if(ClientList.SelectedIndex = 0) then

====================================================================



Whar am I doing wrong here?



Thanks.



ajb





4 Answers

Marina

12/31/2002 4:53:00 PM

0

You need to create an instance of Service1 first, then use it to call
HelloWorld..

"Andy Barlow" <ajbarlow@clarity-dev.com> wrote in message
news:v11k0pjobbu00b@corp.supernews.com...
> I'm trying to get a handle on ASP.Net web services, and am getting nowhere
> fast. Any help would be appreciated
>
>
>
> To begin with, I created a webservice and uncommented the HelloWorld code
> from the example. The file : Service1.asmx is added to my solution:
>
> Imports System.Web.Services
>
> <WebService(Namespace := "http://tempuri....)> _
>
> Public Class Service1
>
> Inherits System.Web.Services.WebService
>
> #Region " Web Services Designer Generated Code "
>
> . . .
>
> #End Region
>
> ' WEB SERVICE EXAMPLE
>
> ' The HelloWorld() example service returns the string Hello World.
>
> ' To build, uncomment the following lines then save and build the
> project.
>
> ' To test this web service, ensure that the .asmx file is the start
page
>
> ' and press F5.
>
> '
>
> <WebMethod()> Public Function HelloWorld() As String
>
> HelloWorld = "Hello World"
>
> End Function
>
> End Class
>
>
>
>
>
> Now, in my client code I have the following:
>
>
>
> Dim strSave as string
>
> strSave = HelloWorld()
>
>
>
> I have alternatively tried using:
>
>
>
> Dim strSave as string
>
> strSave = Service1.HelloWorld()
>
>
>
> In each case I get the following:
>
> ===========================================================
>
> Compiler Error Message: BC30451: Name 'HelloWorld' is not declared.
>
> Line 87: Dim strSave as string
>
> Line 88:
> Line 89: strSave = HelloWorld()
> Line 90:
> Line 91: if(ClientList.SelectedIndex = 0) then
>
> ====================================================================
>
>
>
> Whar am I doing wrong here?
>
>
>
> Thanks.
>
>
>
> ajb
>
>
>
>
>


Andy Barlow

12/31/2002 5:37:00 PM

0

Thanks. I tried that but then I get the error:

Compiler Error Message: BC30002: Type 'Service1' is not defined.

How do I get the ASP page to recognized the external mathod?

Thanks again.

ajb

Matt Pociask

1/1/2003 5:59:00 AM

0

You are missing some steps

First you need to create a WEB REFERANCE

Then you need to declare an instance of the class. The code will look
something like the following:

Dim ws As localhost.Service1 = New localhost.Service1()

Dim szString as String

szString = ws.Service1()



Look on Google for tutorials on how to create a web service.




Andy Barlow

1/2/2003 12:52:00 PM

0

hanks -- I'll give that a try.

ajb

"Matt Pociask" <mattpociask@email.com> wrote in message
news:O0USSKVsCHA.968@TK2MSFTNGP12...
> You are missing some steps
>
> First you need to create a WEB REFERANCE
>
> Then you need to declare an instance of the class. The code will look
> something like the following:
>
> Dim ws As localhost.Service1 = New localhost.Service1()
>
> Dim szString as String
>
> szString = ws.Service1()
>
>
>
> Look on Google for tutorials on how to create a web service.
>
>
>
>