I have device (charger) which sends SOAP-messages to an IP I where I will receive status reports but it is always sent in the root directory and is not changeable: http://192.168.1.2/
I made a WCF service self hosted which I want to receive those messages. But I can not find any information about url-rewriting or listening to something else than the name of the service, in my case it becomes http://192.168.1.2/ocpp15
Is it possible to rewrite/route from / to /ocpp15/ or from /ocpp15/ to / in any way?
Hosting in a Windows service
var smb = new ServiceMetadataBehavior
{
HttpGetEnabled = true,
MetadataExporter = { PolicyVersion = PolicyVersion.Policy12 },
};
var serviceDebugBehavior = new ServiceDebugBehavior { IncludeExceptionDetailInFaults = true };
var baseAddress15 = new Uri(String.Format("http://{0}/, Environment.MachineName));
var host15 = new ServiceHost(typeof(Ocpp15), baseAddress15);
host15.Description.Behaviors.Add(smb);
host15.Description.Behaviors.Remove(typeof(ServiceDebugBehavior));
host15.Description.Behaviors.Add(serviceDebugBehavior);
host15.AddServiceEndpoint(ServiceMetadataBehavior.MexContractName, MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
host15.AddServiceEndpoint(typeof(IOcpp15), new WSHttpBinding(SecurityMode.None), "");
host15.Open();
Service contact
Generated from a WSDL-file with /sc option
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "urn://Ocpp/Cs/2012/06/", ConfigurationName = "Ocpp15")]
public interface IOcpp15
{
// CODEGEN: Generating message contract since the wrapper name (authorizeRequest) of message AuthorizeRequest does not match the default value (Authorize)
[System.ServiceModel.OperationContractAttribute(Action = "/Authorize", ReplyAction = "/AuthorizeResponse")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
AuthorizeResponse Authorize(AuthorizeRequest request);
and so on.....
Service
public class Ocpp15 : IOcpp15
{
public AuthorizeResponse Authorize(AuthorizeRequest request)
{
return new AuthorizeResponse { idTagInfo = ValidateRequest(request) };
}
and so on.....