Rebecca
Rebecca

Reputation: 14412

Is there a way to hack Reference.svcmap to produce a specific svcutil equivalent?

I have a couple of issues with the correct generation of code from a supplied set of WSDLs and XSDs outside my control. To get the right proxy class that works with a custom FaultException, I have the following svcutil params:

svcutil /t:code /out:InvoiceService_v1.cs /n:*,Test.Invoice_v1 /UseSerializerForFaults *.wsdl *.xsd /config:InvoiceService_v1.config

If I add a Service Reference using Visual Studio then the generated proxy incorrectly interprets the custom Fault definition. The settings I need aren't available inside the Visual Studio custom tool.

However, I can see the Reference.svcmap generated by the Add Service Reference tool. Inside that are a number of client options:

<ClientOptions>
    <GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
    <EnableDataBinding>true</EnableDataBinding>
    <ExcludedTypes />
    <ImportXmlTypes>false</ImportXmlTypes>
    <GenerateInternalTypes>false</GenerateInternalTypes>
    <GenerateMessageContracts>false</GenerateMessageContracts>
    <NamespaceMappings />
    <CollectionMappings />
    <GenerateSerializableTypes>true</GenerateSerializableTypes>
    <Serializer>Auto</Serializer>
    <ReferenceAllAssemblies>true</ReferenceAllAssemblies>
    <ReferencedAssemblies />
    <ReferencedDataContractTypes />
    <ServiceContractMappings />
  </ClientOptions>

Is it possible to tweak these setting so that I can use the GUI, rather than using svcutil each time?

Svcutil doesn't automatically download and parse remote XSDs, and the third party has also split the WSDL into a separate binding and interface. There is quite a bit of manual work involved to prep each WSDL and XSD before I can even run svcutil.

The GUI makes the process easy, but I can't figure out how to force it to use alternative switches.

I have already tried to add the following ClientOption but it didn't work. No error, but no class generation either:

<UseSerializerForFaults>false</UseSerializerForFaults>

Any ideas welcomed!

Upvotes: 1

Views: 2864

Answers (1)

Tarek El-Mallah
Tarek El-Mallah

Reputation: 4115

In my case I just edited the "Reference.svcmap" and save it, Don't worry it will not change automatically when you update service reference. so just add this attribute in it and then update service reference.

Upvotes: 2

Related Questions