I am experimenting with creating a proof of concept upload WCF service. I have found the following partly in blog posts around the net:
namespace GreenWebMediaService
{
[ServiceContract]
public interface IMediaServer
{
[OperationContract]
void UploadData(UploadFile data);
}
// Use a data contract as illustrated in the sample below
// to add composite types to service operations.
[DataContract]
public class UploadFile
{
public UploadFile() { }
[MessageHeader]
public string MetaData { get; set; }
[MessageBodyMember]
public Stream data { get; set; }
}
}
i start it (hosting in Visual Studio) and make a reference from a newly created windows forms application, this is my reference, from app.config:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IMediaServer" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00"
sendTimeout="00:01:00" allowCookies="false"
bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" messageEncoding="Text"
textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192"
maxArrayLength="16384" maxBytesPerRead="4096"
maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:49689/MediaServer.svc"
binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IMediaServer"
contract="mediaServer.IMediaServer"
name="BasicHttpBinding_IMediaServer" />
</client>
</system.serviceModel>
</configuration>
when i make a instance of it and refer to it like this:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
IMediaServer mediaServer = new mediaServer.MediaServerClient();
UploadFile file = new UploadFile();
mediaServer.UploadData(null);
}
}
When i access the "file" variable, it only has a "file.ExtensionData" property whereas i would have expected to have access to the properties i made in my "UploadFile" class. What am i missing? I have tried to make a tick in the configure dialog in visual studio as i found this information in other threads, still no luck: see my dialog here: http://screencast.com/t/NzhhNzM3Y2Q (sorry i dont know how long screencast.com will keep this image)