【发布时间】:2020-09-22 01:07:04
【问题描述】:
我工作的一家公司正在开发他们自己的内部解决方案,需要让他们的客户能够继续使用各种版本的 SOAP 服务。
使用svcutil /sc *.wsdl *.xsd 时出现错误;
svcutil /sc *.wsdl *.xsd
Microsoft (R) Service Model Metadata Tool
[Microsoft (R) Windows (R) Communication Foundation, Version 4.8.3928.0]
Copyright (c) Microsoft Corporation. All rights reserved.
Error: All parts of message in operation must either contain type or element.
Error: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
Error: Referenced type 'http://schemas.xmlsoap.org/soap/encoding/:Array' is only valid for encoded SOAP.
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.xxxxxxxxxx.uk/myapp/']/wsdl:portType[@name='ProposalPortType']
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='http://www.xxxxxxxxxx.uk/myapp/']/wsdl:portType[@name='ProposalPortType']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.xxxxxxxxxx.uk/myapp/']/wsdl:binding[@name='ProposalBinding']
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='http://www.xxxxxxxxxx.uk/myapp/']/wsdl:binding[@name='ProposalBinding']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://www.xxxxxxxxxx.uk/myapp/']/wsdl:service[@name='Proposal-service']/wsdl:port[@name='ProposalPort']
Generating files...
Warning: No code was generated.
如果我从消息中删除它
<part name="attachment" type="oneapp:ArrayOfBinary"/>
完整的消息
<message name="ProposalOutput">
<!-- This is the main message content which describes the Proposal -->
<part name="out" element="xsd1:Proposal"/>
<!-- There may be zero to many attachment parts -->
<!--<part name="attachment" type="oneapp:ArrayOfBinary"/>-->
</message>`
然后生成代码,但是通过显式删除这些项目,我不完全确定我删除了什么或它将对需要创建的新服务产生什么影响。
我的问题是,为什么这两个项目会导致代码生成失败,我该如何解决?
【问题讨论】: