|
-
Jul 11th, 2005, 01:27 AM
#1
Thread Starter
Lively Member
Calling Web Service from codebehind?
hi
in our project UI project is in Machine1 and web service is in another system.
how can i call the webservice with help of that system's IP address in my asp.net? [without using the webreference or any tool] Is there any way to achieve this with system.net namespace?
Can anybody help me in this context?
-
Jul 11th, 2005, 03:58 AM
#2
Re: Calling Web Service from codebehind?
Run the wsdl.exe tool:
Code:
wsdl.exe /language:VB /out:C:\abc.vb http://XXX.XXX.XXX.XXX/servicename/service.asmx
This will create a proxy class for you. Everytime you want to use a method from there, instantiate it, and use away!
-
Jul 11th, 2005, 05:50 AM
#3
Thread Starter
Lively Member
Re: Calling Web Service from codebehind?
 Originally Posted by mendhak
Run the wsdl.exe tool:
Code:
wsdl.exe /language:VB /out:C:\abc.vb http://XXX.XXX.XXX.XXX/servicename/service.asmx
This will create a proxy class for you. Everytime you want to use a method from there, instantiate it, and use away!
ok im getting ur point about WSDL. but, if i deployed the UI in one system and WebService in another system(with some modification) how can i access the latest one. i have to recompile my code each time.
-
Jul 11th, 2005, 06:19 AM
#4
Re: Calling Web Service from codebehind?
Store the URL for the webserver name in a config file. In your proxy class, have the constructor only allow an argument to be passed to it, which would be the name of the webserver picked up from the config file.
-
Jul 11th, 2005, 06:24 AM
#5
Re: Calling Web Service from codebehind?
Just to clarify, here's an example:
First, I modified the constructor of the proxy class:
VB Code:
Public Sub New(ByVal strWebServiceServer As String)
MyBase.New()
Me.Url = strWebServiceServer & "EmployeeManager.asmx"
End Sub
Then, from my pages, I call it like this:
VB Code:
Dim em As New EmployeeManager(Configuration.ConfigurationSettings.AppSettings("WebServiceServerName"))
-
Jul 11th, 2005, 07:14 AM
#6
Thread Starter
Lively Member
Re: Calling Web Service from codebehind?
 Originally Posted by mendhak
Just to clarify, here's an example:
First, I modified the constructor of the proxy class:
VB Code:
Public Sub New(ByVal strWebServiceServer As String)
MyBase.New()
Me.Url = strWebServiceServer & "EmployeeManager.asmx"
End Sub
Then, from my pages, I call it like this:
VB Code:
Dim em As New EmployeeManager(Configuration.ConfigurationSettings.AppSettings("WebServiceServerName"))
i dont know how to create the proxy from my coding and access the webmethods?
-
Jul 11th, 2005, 07:45 AM
#7
Re: Calling Web Service from codebehind?
Eh? Didn't understand you...
-
Jul 12th, 2005, 01:10 AM
#8
Thread Starter
Lively Member
Re: Calling Web Service from codebehind?
 Originally Posted by mendhak
Eh? Didn't understand you...
hi,
i saw one article about using system.net namespace and its classes to call webservice. but im not getting that webarticle now. how can we use system.net namespace to call webservice and methods from codebehind?
-
Jul 12th, 2005, 01:20 AM
#9
Re: Calling Web Service from codebehind?
What I just showed you does just that. All your calls are from codebehind. If this isn't what you're asking for, show me the article you had seen...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|