WebReference Change Static to Dynamic Setting not working

I have a Web Reference in my code in which I want to change the URL Behavior from static to dynmaic.  When I do so nothing happens.

I look in the app.config file hoping to see the url reference and nothing has changed.

I also have checked the reference.vb file and it still is hard coded and not referencing the app.config file.

Anyone know what is going on

 



Answer this question

WebReference Change Static to Dynamic Setting not working

  • karlytoz

    As mentioned in earlier post above, you should simply set the url property of your webservice to the desired value.

    SimpleWebService svc = new SimpleWebService();

    svc.Url = http://myservice.com/newurl.asmx

    svc.FirstWebMethod();

    Please let me know what issue you are running into.

    Thanks.


  • Rembo

    Hi guinea13,

    My understanding is that NETCF does not support dynamic URL behavior; please modify the Url property of the web service at run time for updates.

    Cheers,

    Anthony Wong [MSFT]


  • pallavi_020

    Dear guinea13,

    Had u figured out this problem I am having the same problem like u. Doing all the same things as u did. I can't get it work. But, when we set it during development time, it works fine... Please do guide me.. my project is going to due very soon...

    Please helps...



  • awsexton

    Mark, I understand what you are talking aboutbut this does not make it a dynamic webservice.

    After working through this issue many times I have found that it is not possible to change it from static to dynamic in a Compact Framework enviornment. As stated in a post above.

    I have tried to follow along the code with what would need to change in order to make it dynamic and be able to change the webservice on the fly and it just is to much work for me at this time.

    I haven't seen anyone that has done this in a Compact Framework enviornment especially on a PocketPC. So, I guess I will have to save this for another time.


  • KwanzaBot

    Exactly my point. I go from test to quality to production enviornments and all of them have different addresses. I have 2 webservices so that 6 different things I have to change. I really wish they would have made it dynamic.
  • Thunder0ne

    guinea13,

    Same as ur problem, I think compact framework doesn't support the dynamic function. After so many times of trying, i had finally given up the solution by deploying 2 same application with two different web service references. So, when they run it via Internet, they open up the first program, and when they run it via intranet, then, they open up second program.

    This could solve my problem for the time being. But, i am still starving for this solution cause if our software is to be distributed to N number of clients. It's got to be a big problem for me, as developer.. where I need to keep recompile it for different customers....



  • Inga Verbitskaya - MSFT

    I have tried to set a couple of different things but nothing seems to work.

    Here is what I have tried:

    I set code that would load read a xml file that has the webservices in it.

    Try

        rdr = New Xml.XmlTextReader("\Windows\WebServiceUrl.xml")

        While rdr.Read()

          ' Look for a start node.

          If rdr.NodeType = Xml.XmlNodeType.Element Then

                 If rdr.Name = "transactionWebService" Then

                       If rdr.NodeType = Xml.XmlNodeType.Text Then

                           'Set global vaiable   

                           Me.BatchTransWebServiceUrl = rdr.Value

                       End If

                  End If

               If rdr.Name = "inventoryBinWebService" Then

                  If rdr.NodeType = Xml.XmlNodeType.Text Then

                        Me.InventoryServiceUrl = rdr.Value

                 End If

              End If

       End If

    End While

    Catch ex As Exception

           MsgBox("Error Reading WebService XML File. File required for data transfer. ERROR DETAILS: " & ex.Message)

       Me.Close()

    Finally

          If Not rdr Is Nothing Then rdr.Close()

    End Try

     

    After the file was loaded and the webservice was to be called I would set the URL in the Reference.vb file.

    Public Sub New()

         MyBase.New()

         Me.Url = Global.App.program.InventoryServiceUrl

    End Sub

    I thought this would work but didn't.

    I even tried to setting the global vaiable for the webservice URL when reading the xml file:

    Global.App.My.WebServices.BatchTransactionService.Url

    This didn't work eather.

    Anyone know how to do this the right way

     


  • yishyuan

    Where do I modify it

    As in what file.

    I don't see any file which is generated in the release directory that has the URL of the webservice in it.

     

     


  • karefrey

    Hasn't anyone else run into this problem   I am sure others have used this option before. 


  • skea

    Can you try to change URL at runtime
  • Barry Smith

    I've tried changing the Url property of my Web service proxy object during runtime and it works fine. For my case, the WSDL stays the same. Does yours stay the same as well

  • WebReference Change Static to Dynamic Setting not working