none
Create SOAP UI Request using C# Client Application RRS feed

All replies

  • Hi Namdeo42,

    Thank you for posting here.

    Since this thread is related to WCF, I will move it to Windows Communication Foundation, Serialization, and Networking forum to get professional support.

    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 30, 2019 1:55 AM
  • Hi,

    Generally speaking, there are two ways to call web service which based on SOAP message.
    1. By using the client proxy class we could call the service like calling the local static method. 
    ServiceReference1.ServiceClient client = new ServiceClient();
                var result = client.GetData();
                Console.WriteLine(result);

    We could use SVCutil tool or adding service reference in VS to generate the client proxy class. Besides, it also generates the configuration file. We should modify the service endpoint address in the configuration file to conform to the actual service address before calling.
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/how-to-create-a-wcf-client

    2. Channel Factory also is an optional solution to call the service given that we have known the service information, such as service contract, service binding, and service address.
        class Program
        {
            static void Main(string[] args)
            {
                Uri uri = new Uri("http://10.157.13.69:5577");
                BasicHttpBinding binding = new BasicHttpBinding();
                ChannelFactory<IService> factory = new ChannelFactory<IService>(binding, new EndpointAddress(uri));
     
                IService service = factory.CreateChannel();
                try
                {
                    var result = service.GetData();
                    Console.WriteLine(result);
                }
                catch (Exception)
                {
                    throw;
                }
            }
    
        }
        [ServiceContract]
        interface IService
        {
            [OperationContract]
            string GetData();
    }
    
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/feature-details/how-to-use-the-channelfactory
    https://docs.microsoft.com/en-us/dotnet/framework/wcf/samples/channel-factory
    Feel free to let me know if there is anything I can help with.
    Best Regards
    Abraham

    Tuesday, July 30, 2019 8:19 AM
    Moderator