私は、Apache サーバーで実行されている Web サービスを使用するサード パーティと協力しています。オプション minOccurs="0" を持つフィールドがあります。「サービス参照の追加...」コマンドを使用して wsdl ファイルをロードしました。minOccurs="0" の最後の cs ファイル フィールドでは、オプションとしてマークされていません。彼らは通常のクラス メンバーとして扱われます。これらのオプション フィールドなしで返されたデータをデシリアライズすると、エラー メッセージが表示されます。この問題を解決するにはどうすればよいですか?
<complexType name="contactType">
<sequence>
<element minOccurs="0" name="refid" type="ingType32"/>
<element minOccurs="0" name="title" type="csccom:StringType32"/>
<element name="firstname" type="csccom:StringType32"/>
</sequence>
</complexType>
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:csca:xml:ns:csccom-1.1")]
public partial class contactType : object, System.ComponentModel.INotifyPropertyChanged {
private string refidField;
private string titleField;
private string firstnameField;
[System.Xml.Serialization.XmlElementAttribute(DataType="token", Order=0)]
public string refid {
get {
return this.refidField;
}
set {
this.refidField = value;
this.RaisePropertyChanged("refid");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(DataType="token", Order=1)]
public string title {
get {
return this.titleField;
}
set {
this.titleField = value;
this.RaisePropertyChanged("title");
}
}
/// <remarks/>
[System.Xml.Serialization.XmlElementAttribute(DataType="token", Order=2)]
public string firstname {
get {
return this.firstnameField;
}
set {
this.firstnameField = value;
this.RaisePropertyChanged("firstname");
}
}
}
System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader リーダー、MessageVersion バージョン、XmlSerializer シリアライザー、MessagePartDescription returnPart、MessagePartDescriptionCollection bodyParts、Object[] パラメータ、ブール値 isRequest) でのスタック トレース System.ServiceModel.Dispatcher.XmlSerializerOperationFormatter.DeserializeBody(XmlDictionaryReader リーダー、 System.ServiceModel.Dispatcher.OperationFormatter.DeserializeBodyContents(メッセージ メッセージ、Object[] パラメータ、ブール値 isRequest) の System.ServiceModel.Dispatcher.OperationFormatter.DeserializeReply( System.ServiceModel.Dispatcher のメッセージ メッセージ、Object[] パラメーター)。ProxyOperationRuntime.AfterReply(ProxyRpc& rpc) で System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime 操作、ProxyRpc& rpc) で System.ServiceModel.Channels.ServiceChannel.Call(文字列アクション、ブール一方向、ProxyOperationRuntime 操作、Object[] ins、Object [] アウト、TimeSpan タイムアウト) System.ServiceModel.Channels.ServiceChannel.Call (文字列アクション、Boolean oneway、ProxyOperationRuntime 操作、Object[] ins、Object[] outs) で System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall 、ProxyOperationRuntime 操作) System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage メッセージ) で [0] で再スローされた例外: System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke の IMessage retMsg) (MessageData& msgData、Int32 タイプ)