简体   繁体   English

不支持WCF服务操作类型

[英]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.

相关问题 UploadFile:WCF测试客户端不支持此操作,因为它使用类型ClientFileInfo - UploadFile: This operation is not supported in the WCF Test Client Because it uses type ClientFileInfo WCF测试客户端不支持该操作 - Operation not supported in the WCF Test Client wcf测试客户端不支持此操作,因为它使用类型System.IO.Stream - This operation is not supported in wcf test client because it uses type System.IO.Stream 不支持mimetype的WCF服务问题 - WCF Service Problem with not supported mimetype WCFTestClient操作不受支持,因为它是类型 - WCFTestClient Operation not supported because it is type WCF服务登录和操作权限 - WCF service login and operation permissions 不支持服务类型IHostBufferPolicySelector - The service type IHostBufferPolicySelector is not supported WCF服务无法将自定义类(其中包含Exception类型作为成员)序列化为操作协定中的返回类型 - WCF Service Cannot serialize custom class (which contains an Exception type as member) as a return type in operation contract System.ServiceModel 错误 使用 ASP.NET 核心 ZDB974238714CA8DE6FZAACE714CA8DE6FZAACE714CA8DE6FZAACE7 中嵌入 Windows 服务中的 WCF 时不支持操作 - System.ServiceModel error Operation not supported when consuming WCF embedded in Windows Service in ASP.NET Core API WCF服务类型别名 - WCF service type aliases
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM