There are probably lots of ways to accomplish this, but here are my thoughts. Please note that I just included an arbitrary number of strings, you can add/remove as needed.
First, you'll want some sort of "input" object that will be passed to your WCF service that contains your images and string values. Notice the Images property is an array of byte arrays; this is so you can include multiple images.
[DataContract]
public class InputObject
{
[DataMember]
public byte[][] Images { get; set; }
[DataMember]
public string FirstValue { get; set; }
[DataMember]
public string SecondValue { get; set; }
}
Next, you'll want an object that your WCF service will return...
[DataContract]
public class ReturnObject
{
[DataMember]
public string FirstValue { get; set; }
[DataMember]
public string SecondValue { get; set; }
}
Your ServiceContract will look like this.
[ServiceContract]
public interface IService1
{
[OperationContract]
ReturnObject UploadData ( InputObject input );
}
And your Service class like this.
public class Service1 : IService1
{
public ReturnObject UploadData ( InputObject input )
{
// Do your thing with InputObject data
ReturnObject returnObject = new ReturnObject
{
FirstValue = "MyFirstValue" ,
SecondValue = "MySecondValue"
};
return returnObject;
}
}
You'll need to make sure your service's bindings are appropriate for sending image data so increasing some of the default limits is appropriate. Here's an example binding from my service's config.
<wsHttpBinding>
<binding name="Service1Binding" maxReceivedMessageSize="1000000">
<readerQuotas maxArrayLength="1000000"
maxBytesPerRead="1000000"
maxDepth="1000000"
maxNameTableCharCount="1000000"
maxStringContentLength="1000000"/>
</binding>
</wsHttpBinding>
Make sure you specify this as your bindingConfiguration for your service.
<endpoint address=""
binding="wsHttpBinding"
contract="WcfService5.IService1"
bindingConfiguration="Service1Binding">
Now all you need to do is reference this from service from your client and call it.
var images = new byte[2][];
images[0] = System.IO.File.ReadAllBytes( @"D:\Development\TestImage.bmp" );
images[1] = System.IO.File.ReadAllBytes( @"D:\Development\TestImage.jpg" );
var input = new InputObject
{
Images = images ,
FirstValue = "MyFirstValue" ,
SecondValue = "MySecondValue"
};
var client = new Service1Client();
client.UploadData( input );
Hope this helps you out...