|
Framework 2.0
Framework 4.0
Framework 2.0
DiamondManager webServiceManager =
new DiamondManager();
webServiceManager.Login("myUser",
"myPassword");
webServiceManager.Url = "http" + webServiceManager.Url.Substring(5);
UploadFilesParameters ufp = new
UploadFilesParameters();
ufp.FileName = "Test.jpg";
ufp.FileContents = File.ReadAllBytes(@"C:\Test.jpg");
ufp.FileUploadType = FileUploadTypes.Cert;
UploadFilesResult sr = webServiceManager.UploadFiles(ufp);
if (sr.InvalidFilesCount > 0)
{
foreach (FileUploadInfo
fileinfo in sr.InvalidFiles)
{
string FileName = fileinfo.FileName;
string ImageType = fileinfo.ImageType.ToString();
string Url = fileinfo.Url;
}
}
else if (sr.ValidFilesCount > 0)
{
foreach (FileUploadInfo
fileinfo in sr.ValidFiles)
{
string FileName = fileinfo.FileName;
string ImageType = fileinfo.ImageType.ToString();
string Url = fileinfo.Url;
}
}
|
Framework 4.0
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();
AuthenticationTicketHeader ticket = webServiceManager.Login("myUser", "myPassword");
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;
UploadFilesParameters ufp = new
UploadFilesParameters();
ufp.FileName = "Test.jpg";
ufp.FileContents = File.ReadAllBytes(@"C:\Test.jpg");
ufp.FileUploadType = FileUploadTypes.Cert;
UploadFilesResult sr = webServiceManager.UploadFiles(ticket,ufp);;
if (sr.InvalidFilesCount > 0)
{
foreach (FileUploadInfo
fileinfo in sr.InvalidFiles)
{
string FileName = fileinfo.FileName;
string ImageType = fileinfo.ImageType.ToString();
string Url = fileinfo.Url;
}
}
else if (sr.ValidFilesCount > 0)
{
foreach (FileUploadInfo
fileinfo in sr.ValidFiles)
{
string FileName = fileinfo.FileName;
string ImageType = fileinfo.ImageType.ToString();
string Url = fileinfo.Url;
}
}
|
|