tags:

views:

248

answers:

1

I have two ServiceContracts implemented as interfaces. I want to export the metadata for only one of them. The trick is that both interfaces are implemented by the same class. Therefore, I don't think that I can use /excludeTypes. Please include example syntax when answering. Thanks!

EDIT: A co-worker recently asked me why this is necessary. The reason why is that the first ServiceContract is for a REST service, which it doesn't make sense to export metadata for. So I get two wsdl and xsd files generated, distinguishable only because the second filename is appended with "1". This makes tooling difficult, and adds more clutter to the output directory.

I've added a bounty to try and generate interest in this question.

+1  A: 

Hello,

I created a Service Contract class implementing 2 Interfaces like you described.

namespace NS
{
    [ServiceContract]
    public interface IREST
    {
        [OperationContract]
        string WorldHello(string name);
    }

    [ServiceContract]
    public interface IInterface
    {
        [OperationContract]
        string HelloWorld(string name);
    }

    public class CI2 : IREST, IInterface
    {
        public string WorldHello(string name)
        {
            return "World Hello: " + name;
        }

        public string HelloWorld(string name)
        {
            return "Hello World: " + name;
        }
    }
}

when running svcutil normally, I get a wsdl with methods from the 2 interfaces
when I run svcutil with /excludeType:IREST for example, I get only IInterface methods.

svcutil /excludeType:NS.IREST ci2service.exe

are you using the same configuration? In that case /excludeType works.

najmeddine
That worked perfectly! I don't know why it didn't occur to me that I could put the *interface* into /excludeTypes. Thanks for your help--full points awarded!
GuyBehindtheGuy