从v41开始,我停止使用Salesforce提供的合作伙伴WSDL生成C#类。我不认为他们只是在提供版本不正确的WSDL文件,但我找不到其他解释。这是我尝试运行wsdl.exe时得到的信息:
Error: Unable to import binding 'SoapBinding' from namespace 'urn:partner.soap.sforce.com'.
- Unable to import operation 'describeSObject'.
- The datatype 'urn:partner.soap.sforce.com:AdditionalInformationMap' is missing.
好吧,让我们尝试svcutil.exe:
svcutil.exe v45.wsdl /t:code /l:c# /o:"partner_v45.cs"
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.6.1055.0]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: There was an error verifying some XML Schemas generated during export:
Type 'urn:partner.soap.sforce.com:AdditionalInformationMap' is not declared.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Cannot import invalid schemas. Compilation on the XmlSchemaSet failed.
XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:partner.soap.sforce.com']/wsdl:portType[@name='Soap']
Error: Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='urn:partner.soap.sforce.com']/wsdl:portType[@name='Soap']
XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:partner.soap.sforce.com']/wsdl:binding[@name='SoapBinding']
Error: Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='urn:partner.soap.sforce.com']/wsdl:binding[@name='SoapBinding']
XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:partner.soap.sforce.com']/wsdl:service[@name='SforceService']/wsdl:port[@name='Soap']