I am currently trying to create a REST proxy that calls a WCF SOAP service, I am stuck trying to make a channel to send the message through. I know I need to use ChannelFactory, but I don't have the interface of the service. Is there a default value I can pass? Is there another way to package the message?
When I say message, I mean one from ServiceModels.Channels.Message.
I'm very new to this so any help would be appreciated.
You can generate a WCF client from a WSDL service contract in one of two ways:
Either way will generate .NET classes that correspond to the types exposed by the service contract as well as a WCF client proxy class, which you can use to invoke the service operations:
try
{
    var client = new MyServiceClient();
    client.DoSomething();
    client.Close();
}
catch
{
    if (client != null)
    {
         client.Abort();
    }
}
If you prefer to use the lower level ChannelFactory API, you should use the generated IClientChannel interface instead:
try
{
    var factory = new ChannelFactory<MyServiceChannel>();
    var client = factory.CreateChannel();
    client.DoSomething();
    client.Close();
}
catch
{
    if (client != null)
    {
         client.Abort();
    }
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With