5

I have a strange problem happening only when deploying an ASMX web service on the test server. I have a web service with one simple method:

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
public class HarmonyCentralWebClassicService : System.Web.Services.WebService
{
        [WebMethod]
        public List<DeviceSync> GetDeviceSyncByCategoryAndSyncStatus(DeviceSyncCategoryId categoryId, DeviceSyncStatusId syncStatusId)
        {
           // Do something and return a list
           return new List<DeviceSync>();
        }
 }

After deployment to a test server, when I call this method from a .NET client on another machine, I get the following error:

Caught SoapException thrown by System.Web.Services.Protocols::SoapHttpClientProtocol.ReadResponse

Server did not recognize the value of HTTP Header SOAPAction: http://tempri.org/GetDeviceSyncByCategoryAndSyncStatus

I've seen many SO articles and tried deleting Temporarily ASP Net folders and updating the web reference - these did not work (such as these here).

Does anyone have any idea?

Community
  • 1
  • 1
AshesToAshes
  • 937
  • 3
  • 14
  • 31
  • No idea, but FYI, ASMX is a legacy technology, and should not be used for new development. WCF or ASP.NET Web API should be used for all new development of web service clients and servers. One hint: Microsoft has retired the [ASMX Forum](http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/threads) on MSDN. – John Saunders Dec 15 '14 at 20:01
  • Yes you are absolutely right. I've had to take over this technology so am forced to use it at least for the short term. – AshesToAshes Dec 16 '14 at 04:55

1 Answers1

10

Managed to figure out the problem. Very simple solution. Just goes to show if you come back after a few hours, you think more sensibly!

My client app.config was pointing to the wrong ASMX file and so obviously the run-time correctly observed that this action was not recognized by that particular web service.

If anyone faces a similar problem, a very simple check is to ensure you are actually pointing to the desired ASMX web service and that your web references in your client are up to date.

Of course, agree with John's comment - if you have the choice, stick with WCF or ASP.NET Web API.

AshesToAshes
  • 937
  • 3
  • 14
  • 31
  • 2
    Same problem. Same solution. Feel a bit of an idiot now – Martin Davies Jan 23 '20 at 17:07
  • 7 years later, and I to had the same problem, wrong endpoint. ha! – user3398227 May 04 '21 at 21:24
  • There's something to be said about posting the embarrassingly obvious answer to SO questions. Often the issue is so simple yet it's hidden by our desire to make things more complex than they are. Thanks for updating this Ashes – Daniel Jul 02 '21 at 14:30