[英]Scraping KnownType attributes during SvcUtil and WSDL Code generation
[英]svcutil fails to generate code from wsdl file
我工作的一家公司正在开发自己的内部解决方案,需要让他们的客户继续使用 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>`
然后生成代码,但是通过显式删除这些项目,我不完全确定我删除了什么或它将对需要创建的新服务产生什么影响。
我的问题是,为什么这两个项目会导致代码生成失败,我该怎么做才能修复它?
您的 WSDL 文档是关于 Java WebService 的吗?如果是,使用的 svcutil 命令应该如下所示:
svcutil *.wsdl *.xsd /language:C#
根据您提供的信息,我发现您没有添加语言,可能会导致这个问题。
有关 svcutil 的更多信息,请参考以下链接:
https://docs.microsoft.com/en-us/dotnet/framework/wcf/servicemodel-metadata-utility-tool-svcutil-exe
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.