leighhydes
leighhydes

Reputation: 87

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).

Upvotes: 3

Views: 1328

Answers (2)

Reza Aghaei
Reza Aghaei

Reputation: 125197

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";

Upvotes: 1

Chathuranga Ranasinghe
Chathuranga Ranasinghe

Reputation: 549

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)

Upvotes: 1

Related Questions