0

I have many WSDL's and referenced XSD's in a directory structure. Some types in XSD - for example a common message header - are shared among all WSDL's. I run svcutil.exe for each WSDL, to have separate namespace for the service and it's types, but I would like to somehow reuse common types, namely the header, because I would like to have a common handling mechanism for headers. If every header type is in different namespace, it is different type and common processing is difficult.

Can somebody have an idea, how to solve this issue?

EDIT: I'm using XmlSerializer, so I cannot use /r switch of svcutil.exe.

SteveC
  • 15,808
  • 23
  • 102
  • 173
Mikee
  • 626
  • 1
  • 10
  • 23

1 Answers1

0

One approach supported by svcutil is the use of the /reference (/r) switch.

You can generate the common classes and compile them in a separate assembly (using one of those services), then use that assembly as a reference in subsequent invocations of svcutil, for the other services.

A helpful reference might be here. The command line reference is here.

Petru Gardea
  • 21,373
  • 2
  • 50
  • 62
  • Unfortunatelly, Im using XmlSerializer, no DataContractSerializer, because I need to interoperability with Java. But thank you for the idea, I didnt know the /r parameter. – Mikee Apr 08 '14 at 16:47
  • @Mikee, another approach is to build a WSDL on top of ALL other WSDLs, i.e. use wsdl:import to refer to the other ones and then feed that one to svcutil; I can't tell much if it's going to work or not, based on the details you provided; for sure, if there are XSDs reused among the WSDLs, it is guaranteed to work. – Petru Gardea Apr 08 '14 at 16:56