ASP.NET Web References to Web Service Help!!!

Discussion in 'ASP.NET WebServices' started by Bruce, Nov 2, 2004.

  1. Bruce

    Bruce DiscountASP.NET Staff

    can you access the web service directly via the broswer?

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  2. Hello,

    I've created a web app on my PC whereweb services access my SQL Server and my web application utilises these web services.

    I've created my MS SQL tables on the discountasp server, I've copied my web services project. I've tested the asmx file and everything works fine.

    I've copied my asp.net project over and it doesnt work, obviously because the web reference will now be incorrect.

    When I try to replace the web reference, to point to the one I've copied to the discountasp server I get a challenge response... fine...
    URL to the asmx file I'm okay with,
    as well as user name and password
    The 4th line asks for a doman - if I add my domain (eg www.mywebsite.com) I can view the services available from my asmx page, however I get the following error:

    There was an error downloading 'http://www.mywebsite.com/ws4wwc/wwcservice.asmx?op=GetGeoRegions'.
    The underlying connection was closed: The proxy name could not be resolved, verify correct proxy configuration.


    any advice? Am I heading in the right direction?

    regards

    Brian
     
  3. the cut and paste should have read


    There was an error downloading 'http://www.mywebsite.com/ws4wwc/wwcservice.asmx'.
    The underlying connection was closed: The proxy name could not be resolved, verify correct proxy configuration.

    but both failed the same.

    regards

    Brian
     
  4. You can view the service methods but 'still' get the error? Maybe try making the proxy 'dynamic' in VS.NET. then prior to uploading change the Web.Config where your proxy address to your public web site. Anyway, I would think that you could just use localhost since your web service and asp.net page are on the same physical server? For that matter, you can instantiate an instance of the web service without using a proxy if you let them share the same namespace. That would be more efficient. Then if you ever need to access the web service methods remotely, you can still do so through the remote proxy on the client, or in the browser.


    /emoticons/yeah.gif
     
  5. Bruce

    Bruce DiscountASP.NET Staff

    This is really weird!!!

    Usually if you can view the web service via the browser, you should be able to add a web reference in VS.net. The error VS.net is spitting out sounds like a network issue but it doesn't make sense when IE is not having problem.

    Let me do more research and I'll post if i find anything.

    Bruce

    DiscountASP.NET
    www.DiscountASP.NET
     
  6. I've tested the asmx file in IE from its location on the discountasp web server and it works fine, bringing back data from the SQL Server.

    I did initially think maybe its because work has a proxy server to access the internet via, so I installed my ISP dial up settings... but I get the same problem :-(

    When I assign the web reference, I'm referencing the entire name http://www.mywebsite.com/folder/webservice.asmx The asmx page appears in the window on the left, showing each service available, however in the right hand pane (greyed box) it reports the said error message.

    I feel like giving up on the web service for now and just hit stored procedures (as I've done previously) -you try to do things right, and they never work! lol
     
  7. diltonm, I'm afraid you've lost me. Im use to adding a reference to a SQL database within the web.config, but I thought references to web services had to be made by right clicking within the project window, add web reference, then navigate to where your web service exists, give it a name, then start referencing it in code. All this works locally, no problem








    >>


    You can view the service methods but 'still' get the error? Maybe try making the proxy "dynamic" in VS.NET. then prior to uploading change the Web.Config where your proxy address to your public web site. Anyway, I would think that you could just use localhost since your web service and asp.net page are on the same physical server? For that matter, you can instantiate an instance of the web service without using a proxy if you let them share the same namespace. That would be more efficient. Then if you ever need to access the web service methods remotely, you can still do so through the remote proxy on the client, or in the browser.





    <<
     
  8. >> diltonm, I'm afraid you've lost me...

    I re-read what I wrote and though I could perhaps have been more verbose and articulate I'm convinced the information is accurate. Bottom line, is that if the Web Service works in the browser then the client's reference to it should also work.

    On a client machine try running http://www.mywebsite.com/folder/webservice.asmx and see if it generaets the proxy class or spits out errors.

    The server at your work place may not be IIS 6 on Server 2003? If so then try running your service on an II6 server at work and see if you have the same problem.

    My guess is that it ends up being a site configuration issue resolvable in your Web.Config.
     
  9. I've fixed my problem!

    Within your asp.net project, right click the webservice you're referencing, select properties and ensure that URL Behaviour is set to Dynamic.

    This will add a reference into your web.config like the following

    <appSettings>
    <add key="SomeProject.localhost.Service1" value="http://localhost/SomeWebService/Service1.asmx"/>
    </appSettings>

    then all you have to do is change the value property to the location of your internet based webservice, thus

    <add key="SomeProject.localhost.Service1" value="http://www.mywebsite.com/foldername/Service1.asmx"/>

    I still can't link to any internet based web services from VS.NET on my laptop, but atleast I've got my web based project looking at my data via my web service. :)
     

Share This Page