I have created my own WebService
in VS 2010. My project is called sampleWebService
and inside my project I have successfully added/connected to another WebService
this is called practiceService
.
sampleWebService
has just the basic Hello World auto generated code in it, however, practiceService
has Web Method Functions
that handle database calls such as getFirstName, getLastName,...
My question isn't how to extract the data really since I know you have to use either JSON or SOAP
. I'm just wondering what I have to type into my code to be able to see the functions and methods that are in my added web reference practiceService
so I can connect to them.
Or maybe this is accomplished by using JSON or SOAP
Right now my code for my sampleWebService
page is just as is:
<ToolboxItem(False)> _
Public Class Service1
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
You can have a look at the proxy class that was generated when you added the web reference. Also when you create the object of practice service it will give you access to all the web methods exposed in that web service.
To access the web method you have to do something like
ServerName.WebServiceName CallWebService =
new ServerName.WebServiceName();
String sGetValue = CallWebService.MethodName();
Label1.Text = sGetValue;