WSDL:数组错误

本文关键字:错误 数组 WSDL | 更新日期: 2023-09-27 17:57:17

我有一个WSDL,我从中用c#创建对象

<xsd:complexType name="ArrayOfPlentysoapresponsemessage">
  <xsd:sequence>
    <xsd:element name="item" type="tns:PlentySoapResponseMessage" minOccurs="0" maxOccurs="2" nillable="true"/>
  </xsd:sequence>
 </xsd:complexType>

生成的代码为

private PlentySoapResponseMessage[] itemField;
/// <remarks/>
[System.Xml.Serialization.XmlArrayItemAttribute("PlentySoapResponseMessage", typeof(PlentySoapResponseMessage), IsNullable = false)]
public PlentySoapResponseMessage[] item {
  get {
    return this.itemField;
  }
  set {
    this.itemField = value;
  }
}

我从 c# 收到反序列化不起作用的错误我发现的原因是数组导致问题,因为在删除时只有一个项目并且没有错误

这里的消息

[System.ServiceModel.CommunicationException] = {"反序列化操作 ''"GetAuthentificationToken''" 的回复消息正文时出错。

服务器堆栈跟踪:

at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, XmlSerializer serializer, MessagePartDescription returnPart, MessagePartDescriptionCollection bodyParts, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader reader, MessageVersion version, String action, MessageDescription messageDescription, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(Message message, Object[] parameters, Boolean isRequest)
at System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply(Message message, Object[] parameters)
at System.ServiceModel.Dispatcher.ProxyOperationRuntime.AfterReply(ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

WSDL:数组错误

你必须使用 C# API,以 c 结尾

请更改your-shop.de/plenty/api/soap/version114/自your-shop.de/plenty/api/soap/version114c/并使用 C# WSDL 生成新的 C# 类your-shop.de/plenty/api/soap/version114c/?xml