Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 12th, 2004, 12:47 AM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamically Referring Web Services in a Appl.

Hi all,
       I'm developing an stand alone application using VB .NET. In that i'm referring a XML Web Service. while developing the project i'm referring that web service by adding it as a Web Reference in my project... After i've to deploy the project setup in another machine.
Now my question is,
Is it possible to change the XML Web service URL after developing the project or any other way to refer the xml web service dynamically.

Regards,
Chandra Murali
 
Old August 12th, 2004, 01:13 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

My understanding is that once a web reference is loaded, it's locked in. Of course, in most cases, this is fine because the web reference shouldn't change. I suppose you could manually change the stub classes that are generated and modify them such that you could hand the web service stub the URL to use. Just remember that if you update the reference it will overwrite your modifications.
 
Old August 13th, 2004, 07:42 AM
Registered User
 
Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to RoadRacer
Default

There is a way to do make your URL dynamic so to speak, and I actually prefer this method instead of adding a web reference when consuming a web service. What you have to use WSDL from your command prompt and create a class instead of a web reference. This class you create will then grab it's key from your webconfig. From then on, you can figure it out on how you want to make the change.

wsdl http://www.yourwebservicelocation.co...ebservice.asmx /appsettingurlkey:YourWebserviceURLKey

YourWebserviceURLKey is what the key needs to be named in your Web.Config file which your class will pull. Change it at will!

There are also MANY parameters especially involving proxy settings should your situation require them.

I hope this helps!

I HATE COMPUTERS!
 
Old August 13th, 2004, 07:48 AM
Registered User
 
Join Date: Aug 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to RoadRacer
Default

Sorry about a 2nd consecutive post but I couldn't find an edit feature :D

Anyhow, I just wanted to point out why this is my prefered way instead of adding web references is because in a multi-staging environment, the url to the webservice may (and in my case it does) change in every stage: development (my local machine), testing, then production. It's much easier to just change my web.config file then to change the webreference every time at every stage.

Once the class is created, just add it to your project and delete that pesky web reference! Then, just use the class.

I HATE COMPUTERS!
 
Old September 29th, 2004, 11:24 PM
Registered User
 
Join Date: Aug 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi all,
      First of all I'll thank all people for this response :). In my previous problem I'm actually using the Web service in a VB.Net application and once again this VB.Net application is developed in .Net Compact Framework. In this VB.Net application it is not possible to add the Web service URL in the app.config file, because it's not possible to edit the app.config file in Pocket PC as per my knowledge. So, I'm still hanging in this problem .

Kindly suggest me possible solution.

Thanks in Advance,
Regards,
S. Chandra Murali

Regards,
Chandra Murali
 
Old September 30th, 2004, 02:35 AM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anupam_luv
Default

Hey dude....... I'm facing the same problem in .net Compact framework. I'm developing an Order Processing Software for pocket pc 2003.... On the Login form I've given the option to enter the "Server IP" so that it should pickup all the Web Services from tht URL, but can't handle that. I'm still working with a fixed IP.

Moreover in PocketPC is not taking the Computer Name instead of the IP otherwise I would have asked the my clients to change thier Computer Name, Instead of changing the IP add...... If u can help me out by either tellin me how to keep the comp name instead of IP (May be it has smthng to do with DNS server or whatever)
OR any option to change WebService URL Dynamically (This solution will be the best one to apply)
Thnx in Advance

(ANUPAM ANAND)

 
Old October 1st, 2004, 03:51 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 449
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to r_ganesh76
Default

You can change the url property of the declared object to the new url. You can put the new url in the web.config

MyNameSpace.MyWS oWS = MyNameSpace.MyWS();
MyWS,Url = ConfigurationSettings.AppSettings["WSURL"];
MyWS.MyWSMethod();

Regards
Ganesh
 
Old October 1st, 2004, 07:25 AM
Registered User
 
Join Date: Sep 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anupam_luv
Default

Well ganesh thnx 4 the response but there's no object 'ConfigurationSettings' avail there. But if it is thr even then my case is not resolved as I want to set it dynamically like this...(see the following coding)
(you can see the interface here at http://jobsindia.tripod.com/pocket.html)
Code:
        Dim usr1 As String = Trim(TextBox1.Text)
        Dim pass1 As String = Trim(TextBox2.Text)
        Dim ServerIP As String = Trim(TextBox3.Text)
Try
'The Line     Public DataWS1 As New datasetws 'Web Service 
'is declared in a Module to be accessed Globally

            DataWS1.Url = ServerIP 'This is the line which i want to use but not working 
'And If I remove/comment this line and give the IP of WebService in Design time as "Web Reference URL" property of the My WebReference It starts working
            If DataWS1.CheckUserPass(usr1, pass1) Then
                InputPanel1.Enabled = False
                user1 = usr1
                MsgBox("ACCESS GRANTED")
                '   msgLabel1.Text = ""
                TextBox1.Text = ""
                TextBox2.Text = ""
            Else
                MsgBox("ACCESS DENIED")
            End If

Catch ex As Exception
            MsgBox("Invalid IP Given or Database may be in use. Please Fix The Problem And Re-login.", , "Problem Connecting")
        End Try
So plz help me out finding the solution to that..
Thnx
(Anupam Anand)






Similar Threads
Thread Thread Starter Forum Replies Last Post
web services tanzi C# 1 September 23rd, 2007 02:59 AM
Help for Web Services vivekshah C# 0 June 8th, 2006 08:15 AM
General web based Excel VBA Appl. querry jmax3264 BOOK: Excel 2003 VBA Programmer's Reference 0 March 13th, 2006 01:49 PM
Web Services Error (Ch18) - No Web Disc. Info. ElPato BOOK: Beginning ASP.NET 1.0 2 April 13th, 2005 03:27 PM
Web Services qadeerahmad .NET Web Services 1 August 7th, 2004 11:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.