0

XSD と WSDL を取得したサービス URL がないため、1 つの WCF サービスを使用しようとしています。現時点では、そのために POC を試しています。svcutilツールで生成されたクラス ファイルを使用します。私は WCF にあまり詳しくないので、まずこれらのクラスを C# で使用してみます。

以下は私の完全なコードです:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace smsclient
{
    public interface ISendSms
    {
    sendMessageResponse1 sendMessage(sendMessageRequest request);
    }

    public class AccessSMSDetails: ISendSms
    {

  sendMessageResponse1 ISendSms.sendMessage(sendMessageRequest request)
        {
           //Here is my implementation code.          
            sendMessageResponse sresponse = new sendMessageResponse();
            sresponse.messageid = 1;
            sresponse.recipient = "Chiranjeevi";
            sresponse.reference = "reference";
            sresponse.status = "sucsesss";

            sendMessageResponse1 sresponse1 = new sendMessageResponse1(sresponse);
            return sresponse1;

        }
    }

    public class Program 
    {
        static void Main(string[] args)
        {
            sendMessage sm = new sendMessage();
            sm.content = "Content";
            sm.destination = "Destination";
            sm.reference = "reference";
            sendMessageRequest sRequest = new sendMessageRequest(sm);
            sendMessageResponse1 sclient = new sendMessageResponse1();
            AccessSMSDetails asms = new AccessSMSDetails();
          //sclient=            
          // Here I am not getting the interface Method name to call. Please correct Me if this approach is wrong.
        }
    }
}

最後の行では、インターフェイス メソッドを呼び出すことができません。

4

2 に答える 2