Sample Code


Framework 2.0
Framework 4.0


Framework 2.0

DiamondManager webServiceManager = new DiamondManager();

//This must be done in HTTPS protocol
webServiceManager.Login("myUser", "myPassword");

//After log in you will receive a encrypted ticket with your credentials. This will be used to authenticate your session.
//Now you can choose to change the protocol to HTTP so it works faster.
webServiceManager.Url = "http" + webServiceManager.Url.Substring(5);


//uploading image or zip files

UploadFilesParameters ufp = new UploadFilesParameters();

ufp.FileName = "Test.jpg"; //or Test.zip

ufp.FileContents = File.ReadAllBytes(@"C:\Test.jpg");//or Test.zip
ufp.FileUploadType = FileUploadTypes.Cert;

UploadFilesResult sr = webServiceManager.UploadFiles(ufp);

if (sr.InvalidFilesCount > 0)
{
//if it is a zip file you can get more then one file result
  foreach (FileUploadInfo fileinfo in sr.InvalidFiles)
  {
    string FileName = fileinfo.FileName;
    string ImageType = fileinfo.ImageType.ToString();
    string Url = fileinfo.Url;
  }
}
else if (sr.ValidFilesCount > 0)
{
//if it is a zip file you can get more then one file result
  foreach (FileUploadInfo fileinfo in sr.ValidFiles)
  {
    string FileName = fileinfo.FileName;
    string ImageType = fileinfo.ImageType.ToString();
    string Url = fileinfo.Url;
  }
}




Framework 4.0

//in your binding setting increacse the timeout and buffer sizes
closeTimeout="00:05:00" openTimeout="00:05:00"
receiveTimeout="00:10:00" sendTimeout="00:05:00"
maxBufferSize="65536" maxBufferPoolSize="5242880" maxReceivedMessageSize="655360"

<system.web>
  <compilation debug="false"/>
  <httpRuntime executionTimeout="2000000"/>
</system.web>


DiamondManagerSoapClient webServiceManager = new DiamondManagerSoapClient();

//This must be done in HTTPS protocol
AuthenticationTicketHeader ticket = webServiceManager.Login("myUser", "myPassword");

//After log in you will receive a encrypted ticket with your credentials. This will be used to authenticate your session.
//Now you can choose to change the protocol to HTTP so it works faster.
string oldAddress = webServiceManager.Endpoint.Address.ToString();
string newAddress = "http" + webServiceManager.Endpoint.Address.ToString().Substring(5);
System.ServiceModel.EndpointAddress address = new System.ServiceModel.EndpointAddress(newAddress);
webServiceManager.Endpoint.Address = address;

//uploading image or zip files

UploadFilesParameters ufp = new UploadFilesParameters();

ufp.FileName = "Test.jpg"; //or Test.zip

ufp.FileContents = File.ReadAllBytes(@"C:\Test.jpg");//or Test.zip
ufp.FileUploadType = FileUploadTypes.Cert;

UploadFilesResult sr = webServiceManager.UploadFiles(ticket,ufp);;

if (sr.InvalidFilesCount > 0)
{
//if it is a zip file you can get more then one file result
  foreach (FileUploadInfo fileinfo in sr.InvalidFiles)
  {
    string FileName = fileinfo.FileName;
    string ImageType = fileinfo.ImageType.ToString();
    string Url = fileinfo.Url;
  }
}
else if (sr.ValidFilesCount > 0)
{
//if it is a zip file you can get more then one file result
  foreach (FileUploadInfo fileinfo in sr.ValidFiles)
  {
    string FileName = fileinfo.FileName;
    string ImageType = fileinfo.ImageType.ToString();
    string Url = fileinfo.Url;
  }
}