[英]The WCF service operation type is not supported
I've created a WCF service with 2 asynchronous operations. 我创建了具有2个异步操作的WCF服务。 WCFTestClient returns an error: WCFTestClient返回错误:
The operation is not supported in WCF Test Client because it uses type SendCreditTransferRequest. WCF测试客户端不支持该操作,因为它使用类型SendCreditTransferRequest。
I don't understand the ProcessingFault
operation works and the other ( SendCreditTransferRequest
) why does not. 我不明白ProcessingFault
操作的工作原理,而其他( SendCreditTransferRequest
)为什么不起作用。
My .svc
code: 我的.svc
代码:
namespace SimulatorServices
{
public class RealTimePortType : IRealTimePortType
{
public void SendCreditTransferRequest(SendCreditTransferRequest request)
{
throw new NotImplementedException();
}
public void ProcessingFault(ProcessingFault1 request)
{
throw new NotImplementedException();
}
}
}
My .svc.cs
code: 我的.svc.cs
代码:
namespace SimulatorServices
{
[ServiceContract]
public interface IRealTimePortType
{
[System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://realtime247.eu/realtime247/SendCreditTransferRequest")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
void SendCreditTransferRequest(SendCreditTransferRequest request);
[System.ServiceModel.OperationContractAttribute(IsOneWay = true, Action = "http://realtime247.eu/realtime247/ProcessingFault")]
[System.ServiceModel.XmlSerializerFormatAttribute()]
void ProcessingFault(ProcessingFault1 request);
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
[KnownType(typeof(TransactionHeader))]
[KnownType(typeof(Document))]
public partial class SendCreditTransferRequest
{
[System.ServiceModel.MessageHeaderAttribute(Namespace = "urn:eu:nets:realtime247:ri.2015.10.14")]
public TransactionHeader TransactionHeader;
[System.ServiceModel.MessageBodyMemberAttribute(Name = "SendCreditTransferRequest", Namespace = "urn:eu:nets:realtime247:ri.2015.10.14", Order = 0)]
public Document SendCreditTransferRequest1;
public SendCreditTransferRequest()
{
}
public SendCreditTransferRequest(TransactionHeader TransactionHeader, Document SendCreditTransferRequest1)
{
this.TransactionHeader = TransactionHeader;
this.SendCreditTransferRequest1 = SendCreditTransferRequest1;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute(IsWrapped = false)]
[KnownType(typeof(TransactionHeader))]
[KnownType(typeof(ProcessingFault))]
public partial class ProcessingFault1
{
[System.ServiceModel.MessageHeaderAttribute(Namespace = "urn:eu:nets:realtime247:ri.2015.10.14")]
public TransactionHeader TransactionHeader;
[System.ServiceModel.MessageBodyMemberAttribute(Namespace = "urn:eu:nets:realtime247:ri.2015.10.14", Order = 0)]
public ProcessingFault ProcessingFault;
public ProcessingFault1()
{
}
public ProcessingFault1(TransactionHeader TransactionHeader, ProcessingFault ProcessingFault)
{
this.TransactionHeader = TransactionHeader;
this.ProcessingFault = ProcessingFault;
}
}
}
Sorry but I don't copy all the classes which I created... 抱歉,但我没有复制我创建的所有类...
I tested my operations without class declaration, ad these work fine. 我在没有类声明的情况下测试了我的操作,并且广告效果很好。 So I tested step-by-step the sub classes of SendCreditTransferRequest
and I found the source of problem. 因此,我逐步测试了SendCreditTransferRequest
的子类,并找到了问题的根源。 I use the AccountIdentification4Choice
sub class in SendCreditTransferRequest
which is a choise object in the pacs.008.001.02 (it is a ISO20022) xsd. 我在SendCreditTransferRequest
使用AccountIdentification4Choice
子类,它是pacs.008.001.02(它是ISO20022)xsd中的选择对象。
<xs:complexType name="AccountIdentification4Choice">
<xs:sequence>
<xs:choice>
<xs:element name="IBAN" type="IBAN2007Identifier"/>
<xs:element name="Othr" type="GenericAccountIdentification1"/>
</xs:choice>
</xs:sequence>
</xs:complexType>
I defined it this way: 我是这样定义的:
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace = "urn:iso:std:iso:20022:tech:xsd:pacs.008.001.02")]
public partial class AccountIdentification4Choice
{
private object itemField;
[System.Xml.Serialization.XmlElementAttribute("IBAN", typeof(string), Order = 0)]
[System.Xml.Serialization.XmlElementAttribute("Othr", typeof(GenericAccountIdentification1), Order = 0)]
public object Item
{
get
{
return this.itemField;
}
set
{
this.itemField = value;
}
}
}
but it is fail. 但这是失败的。 So the new question is, how can I declare a choise object in WCF service? 因此,新问题是,如何在WCF服务中声明选择对象?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.