如何用肥皂UI传递一个Stream [英] How to pass a Stream using soap UI
问题描述
我无法测试用肥皂UI WCF服务方法,该方法接受一个Stream对象。这是对象的服务方法作为输入参数:
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;
}
}
}
在SOAP UI生成的请求
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>
我需要什么肥皂UI做测试这种方法吗?
What do I need to do in soap UI to test this method?
推荐答案
您只需要调用特定TestRequest属性您的请求。
You just have to call your request with specific TestRequest Properties.
打开TestRequest属性:
内置回应附件
= TRUE
启用内嵌文件
= TRUE
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.
在对设置页的附件您的请求,请点击
并添加文件。
这篇关于如何用肥皂UI传递一个Stream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!