1
votes

The WCF client is generating duplicate data contracts under different namespace for shared data contracts used in multiple Java services.

Example: 2 Java Service using shared.xsd this schema has approx 1000 complex and simple types defined.
1. Booking Service uses two schemas
a. Booking.xsd
b. shared.xsd

2. Ticketing Service uses two schemas
a. Ticketing.xsd
b. shared.xsd

When i add a service reference in Visual Studio for both the services the data contracts define in Shared.xsd are created under namespaces provided.

So for example Person class is defined twice, one in Foo.BookingService namespace and similarly in Foo.TicketingService namespace.

Is there a way, i can specify a command option or through visual studio that it should reuse the Shared.xsd data contracts and should not regenerate.

1

1 Answers

0
votes

Try to use svcutil.exe to generate .NET datacontract types that conform to XML serializer format. e.g.

svcutil.exe /target:code /dataContractOnly /serializer:XmlSerializer /importXmlTypes [your xsd file's path]