I am trying to create a WCF application that will listen for requests from a suppliers system. The supplier has provided me with a WSDL so I need to create a service and expose its' endpoint to them.
I have used SvcUtil.exe to generate the C# classes, but it outputs rather odd-looking types.
This is a snippet of the WSDL that has been given to me:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified">
<s:element name="Submit">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="Incident">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" form="unqualified" name="TransactionId" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified" name="TransactionType" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified" name="TransactionSubType" type="s:string" />
<s:element minOccurs="0" maxOccurs="unbounded" form="unqualified" name="ConfigurationItem">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" form="unqualified" name="AssetTag" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" form="unqualified" name="Name" type="s:string" />
....
The command I run is simply
svcutil.exe file_name.wsdl
I would expect that this creates a structure like this:
class Submit { ... }
class Incident { ... }
class ConfigurationItem { ... }
So that when it is serialized I get something like:
<Submit>
<Incident>
<TransactionId>12345</TransactionId>
<TransactionType>12345</TransactionType>
<TransactionSubType>12345</TransactionSubType>
<ConfigurationItem>
<AssetTag>xyz</AssetTag>
<Name>name</Name>
</ConfigurationItem>
</Incident>
</Submit>
However, the output of SvcUtil.exe gives me the following:
class SubmitIncident { ... }
class SubmitIncidentConfigurationItem { ... }
It's seems to bunch up the Submit and the Incident objects into one, and also it prepends 'SubmitIncident' onto each of the nested elements. So when serializing I get this:
<SubmitIncident>
<TransactionId>...</TransactionId>
<TransactionType>...</TransactionType>
<TransactionSubType>...</TransactionSubType>
<SubmitIncidentConfigurationItem>
<AssetTag>...</AssetTag>
<Name>...</Name>
</SubmitIncidentConfigurationItem>
</SubmitIncident>
This causes problems with both the supplier (my service doesn't match their WSDL so they can't talk to me), and with onward processing I am doing in the application. Can anyone help me understand why this is happening, how to stop it, and get SvcUtil to output properly.