none
Test WCF Streaming by Post man RRS feed

  • Question

  • Hello,

    •     I have a WCF method to upload file :

          ** Data Contract

                 [MessageContract]
        public class FileData
        {
            [MessageHeader]
            public string FileName { get; set; }
            [MessageHeader]
            public long Size { get; set; }
            [MessageBodyMember]
            public Stream Content { get; set; }
        }   

           ** Interface

                  [ServiceContract]
                  public interface IService1
                   {
                      [OperationContract]
                      void Upload(FileData fileData);
                   }

           ** Service

                public class Service1 : IService1
        {
                       private string GetFilePath(string fileName)
                 {
               return Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "App_Data", fileName);
                }
             public void Upload(FileData fileData)
               {
                 var filePath = GetFilePath(fileData.FileName);
                  using (var localFile = File.Create(filePath))
                  using (fileData.Content)
                      fileData.Content.CopyTo(localFile);
             }
            }   

    •    When I test the Service by Post man not working , I write a  console app application and it is working . So How I can test  it by post man .

               

      

       Thanks


    ASk


    • Edited by himo Monday, March 26, 2018 6:29 AM
    Monday, March 26, 2018 6:27 AM

All replies

  • I write a  console app application and it is working .

    Well that should have been enough.

    So How I can test  it by post man .

    Why?

    Monday, March 26, 2018 3:48 PM
  • Hi himo,

    It is impossible to test your project with PostMan.

    PostMan is used to test Rest Service, and your Service is WCF Soap Service. If you need to create a service accept Http Request, I suggest you try WCF Rest Service.

    Best Regards,

    Tao Zhou


    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, March 27, 2018 1:53 AM