Login    
 
 
 
 
Text/HTML
  
You are here :: Blogs Saturday, May 19, 2012

Search
Note: This uses the internal blog search engine. The Google search engine is also available at the top of the page.
  
Disclaimer

Please review the site disclaimer before downloading or using content found on this site

  
Categories
  
DEVSHED Blog
As always, I welcome your comments!
Jul 2

Written by: Steve Gray
7/2/2009 2:55 PM  RssIcon

When I develop a VB application that calls a web service, I usually am developing the web service in the same solution. That's convenient, because you can step through and debug all the code.

But I'd also like to be able to deploy the web service and have my VB app call the live service. So...

Here's VB code that will call a web service with a dynamic URL. First, the app.config entry that makes it possible:

<appSettings>
    <add key="webservicezzz" value="http://localhost/GPConnect.asmx" />
    <add key="webservice" value="http://localhost:1906/eConnect/GPConnect.asmx" />
</appSettings>

 

What I do is manipulate the 'zzz's to call the dev or live service. (the one with the '1906' is the dev one... but you knew that)

Code to call the service in Visual Studio 2005:

Dim webService As localhost.GPConnect = New localhost.GPConnect
Dim strURL As String = System.Configuration.ConfigurationManager.AppSettings("webService")
 
webService.Url = strURL
webService.myMethod()
 

 

It's just a little different in 2008:

Dim strURL As String = System.Configuration.ConfigurationManager.AppSettings("webService")
Dim url As New System.ServiceModel.EndpointAddress(strURL)
 
Dim webService As New GPconnectLocal.GPConnectSoapClient
webService.Endpoint.Address = url
 
webService.Send("", "localhost", "")

 

 

As always, I welcome and comments or feedback.

Tags:
Categories:
As always, I welcome your comments!
  
 
 
Home | Products | Blogs | Contact Us | Links | God's Plan
Privacy Statement | Terms Of Use
 
Copyright 2011 by Devshed.us