Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect ASMX to another server

I've hit a blocker with an issue I'm working on, any suggestions gratefully received. I am using a web service which has moved to a new server.

The URL has shifted from

https://www.example.co.uk/webservice/api.asmx

to

http://www.example.co.uk/webapistd/api.asmx

If I update the web reference in the .net project and run the code, I receive a 301 Moved Permanently error (no redirect URL is sent through).

Note this is an old style web reference, not a service reference.

Does anyone have any ideas what may be behind this? I'm pretty sure the new URL is correct.

Could it be something else that gets masked as a 301 error, e.g. a different SOAP version?

Just trying to cast the net further rather than rewriting to use a service reference (which may or may not resolve the issue).

like image 467
leighhydes Avatar asked Aug 07 '26 22:08

leighhydes


2 Answers

Check below mentioned files of your project to check if the reference to the new web service has updated correctly (Example : “https” to “http”)

  1. Web.config
  2. Reference.map
  3. YourwebserviceName.disco (api.disco)
like image 58
Chathuranga Ranasinghe Avatar answered Aug 10 '26 13:08

Chathuranga Ranasinghe


When calling an asmx WebService that you have added its reference to your project, visual studio creates an entry in Settings.settings ans sets its value to the url that you added service.

When you call var svc= new Service1(); it uses the value of that setting as Url of service.

To change the url:

  • you can change the default url in the Settings.settings
  • You can pass the new url to service simply using svc.Url="your new url";
like image 35
Reza Aghaei Avatar answered Aug 10 '26 13:08

Reza Aghaei