Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass a Stream using soap UI

I am having trouble testing a WCF service method with soap UI which accepts a Stream object. This is the Object the service method has as input parameter:

[DataContract(Namespace = Constants.NAMESPACE)]
public class RemoteFileInfo : IDisposable
{
    [DataMember(IsRequired = true, Order = 1)]
    public string FileName { get; set; }

    [DataMember(IsRequired = true, Order = 2)]
    public long Length { get; set; }

    [DataMember(IsRequired = true, Order = 3)]
    public System.IO.Stream FileByteStream { get; set; }

    public void Dispose()
    {
        if (FileByteStream != null)
        {
            FileByteStream.Close();
            FileByteStream = null;
        }
    }
}

The generated request in soap UI:

...
<ws:File>
  <ws:FileName>?</ws:FileName>
  <ws:Length>?</ws:Length>
  <ws:FileByteStream>
    <sys:__identity>?</sys:__identity>
  </ws:FileByteStream>
</ws:File>

What do I need to do in soap UI to test this method?

like image 944
amaters Avatar asked Nov 12 '22 10:11

amaters


1 Answers

You just have to call your request with specific TestRequest Properties.

Turn the TestRequest Properties : Inline Response Attachments = True Enable Inline Files = True

Also if your request send the file you need to attach the files in your request.

In your request click on the tab attachments and add the file.

like image 191
David McDuff Avatar answered Nov 15 '22 06:11

David McDuff