I’m in the process of making our API support SOAP but a WebServiceException is thrown every time, “An HTTP Content-Type header is required for SOAP messaging and none was found.”. Looking at the source code what I’m doing below should work just fine.
[Test]
public void GetDevice_Soap12_AsExpected()
{
using (var soapClient = new Soap12ServiceClient("http://localhost:8088/"))
{
GetDevice request = new GetDevice()
{
Id = 1,
};
GetDeviceResponse response = soapClient.Send<GetDeviceResponse>(request);
}
}
[Route("/api/device")]
[DataContract]
public class GetDevices : IReturn<GetDevicesResponse>
{
[DataMember]
public int Id { get; set; }
}
[DataContract]
public class GetDevicesResponse
[Route("/api/device")]
[DataContract]
public class GetDevices : IReturn<GetDevicesResponse>
{
[DataMember]
public int Id { get; set; }
}
[DataContract]
public class GetDevicesResponse { }
[Test]
public void Can_call_GetDevices_with_Soap12ServiceClient()
{
var client = new Soap12ServiceClient("http://localhost:49488/");
var response = client.Send(new GetDevices());
}
Please fork the TestApp repo and modify it so that the SoapTest repros the issue.