Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASMX Web Service "Server did not recognize the value of HTTP Header SOAPAction"

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?

like image 613
AshesToAshes Avatar asked Jan 09 '23 06:01

AshesToAshes


1 Answers

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.

like image 152
AshesToAshes Avatar answered Jan 31 '23 18:01

AshesToAshes