0

I'm testing one of the wcf services published with BizTalk with biz unit, and using following code,

 WebServiceStep wsStep = new WebServiceStep();
 wsStep.ServiceUrl = //service url;
 wsStep.FailOnError = true;
 wsStep.Action = //service method name;

 wsStep.RequestBody = new FileDataLoader() { FilePath = "request.xml"); 
 testCase.ExecutionSteps.Add(wsStep);

The given method usually return a lot of data which exceeds the maximum message size quota for incoming messages (65536), the problem is how can I set the MaxReceivedMessageSize in above test code?

Low Flying Pelican
  • 5,974
  • 1
  • 32
  • 43

1 Answers1

0

The framework doesn't seem to expose that property by default, but you could add it in pretty easily. Copy the code from WebServiceStep.cs into your project, and find following block:

var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
binding.UseDefaultWebProxy = true;      

If you want the max size to be 10MB, you'd want to add something like:

binding.MaxReceivedMessageSize = 10000000;

You could add a property to the class to make this configurable if desired - that'd be slightly more involved (but not terribly difficult).

Don't forget to rename the class and alter the namespace to your project so that you can access it from your own tests....

Dan Field
  • 20,885
  • 5
  • 55
  • 71