使用microsoft net wsdl.exe工具將WSDL轉換爲C#類,但該工具無法轉換WSDL文件的以下部分。任何指針在正確的方向非常讚賞。將WSDL轉換爲C#類
WSDL輸入
<complexType name="Merchant">
<sequence>
<element name="iId" type="xsd:int" />
<element name="sName" type="xsd:string" />
<element name="sDescription" type="xsd:string" minOccurs="0" />
<element name="aSectors" type="api:ArrayOfMerchantSectors" minOccurs="0" />
</sequence>
</complexType>
<complexType name="ArrayOfMerchant">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="api:Merchant[]" />
</restriction>
</complexContent>
</complexType>
<complexType name="MerchantSector">
<sequence>
<element name="iSectorId" type="xsd:int" />
<element name="sSectorName" type="xsd:string" />
</sequence>
</complexType>
<complexType name="ArrayOfMerchantSectors">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="api:MerchantSector[]" />
</restriction>
</complexContent>
</complexType>
C#輸出?????
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://api.someexampledomain.com/")]
public partial class ArrayOfMerchant : Array
{
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "http://api.someexampledomain.com/")]
public partial class ArrayOfMerchantSectors : Array
{
}
我想知道如何定義類「商人」和「ArrayOfMerchant」。
謝謝。
什麼是您所遇到的具體問題?另外,您是否知道WSDL.EXE是傳統技術?你應該使用svcutil.exe或者只是使用「添加服務引用」,除非你被困在.NET 2.0中。 –
我正在採取不同的方法,使用以下URL作爲起點http://stackoverflow.com/questions/4791794/c-sharp-client-send-soap-request-and-get-results。不知道關閉這個問題的最佳方式。 – Steven