Search code examples
wcfwcf-binding

How do I reuse complex types accross different services?


I have 2 separate java services that use a complex type that is a exactly the same but takes an email object as a parameter like:

class Email{
     Description{get;}
     Address{get;}
}

The services look something like this:

emailBasketBallTeam(email); emailTennisTeam(email);

Is there a way that I can specify a contract for the email object or somehow reuse the email object in different services despite them being in completely different namespaces?


Solution

  • Unlike wsdl /sharetypes, you need to consume one service at a time, but you can re-use types from existing assemblies.

    With svcutil, you can use the /reference switch. I believe you can also do this in the IDE in the designer.