0

I've created a WCF service with 2 asynchronous operations. WCFTestClient returns an error:

The operation is not supported in WCF Test Client because it uses type SendCreditTransferRequest.

I don't understand the ProcessingFault operation works and the other (SendCreditTransferRequest) why does not.

My .svc code:

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:

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...

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • How do you define the SendCreditTransferRequest class? There may be some unsupported type in your definition. besides, I suggest you try to test the service in the actual console application(add service reference) instead of WCFTestclient.https://stackoverflow.com/questions/9846746/operation-not-supported-in-the-wcf-test-client https://stackoverflow.com/questions/10088252/this-operation-is-not-supported-in-the-wcf-test-clientwcf-entity-data-model – Abraham Qian Feb 25 '19 at 09:46
  • @Abraham thx! I found the source of problem. – Peter.Csanyi Feb 25 '19 at 12:31

1 Answers1

0

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. I use the AccountIdentification4Choice sub class in SendCreditTransferRequest which is a choise object in the pacs.008.001.02 (it is a 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?