Switch client SDK

Post Reply
mostafa_hamdy
Newbie
Posts: 4
Joined: Tue Aug 16, 2011 3:21 pm

Switch client SDK

Post by mostafa_hamdy »

Hello all

I'm using switch client SDK service , with .net client and I connect to the switch server correctly and the get methods works correctly , but when I try to use the SubmitFile10 web method I get the following error message:The underlying connection was closed: An unexpected error occurred on a receive.” the code segment I wrote is as the following:



string[] iIList = service.GetFlowList();



Console.WriteLine("Number of flows in the system: " + iIList.Length.ToString());

Console.WriteLine("================================== ");

for (int i = 0; i < iIList.Length; i++)

{

Console.WriteLine(iIList);

string[] arrCheckPoints = service.GetCheckPoints(iIList);

string[] arrSubmitPoints = service.GetSubmitPoints(iIList);

#region SubmitJob

if (arrSubmitPoints != null && arrSubmitPoints.Length > 0 && service.GetFlowName(iIList) == "Mindworking Media Cloud")

{

SubmitEntry inEntry = new SubmitEntry();



inEntry.flowId = iIList;

inEntry.jobName = "inject_job2.zip";



//An indication of the origin of the processed job before it was injected in the flow; for example, a Submit point writes the absolute path of

//the original job (on the client machine) in this field

//inEntry.jobOrigin = @"C:UsersPublicPicturesAllblank.gif";

inEntry.jobOrigin = @"C:UsersMostafaDesktopinject_job2.zip";

inEntry.submitPointId = arrSubmitPoints[0];



//byte[] inSubmitData = File.ReadAllBytes(@"C:UsersPublicPicturesAllblank.gif");

byte[] inSubmitData = File.ReadAllBytes(@"C:UsersMostafaDesktopinject_job2.zip");



try

{

Console.WriteLine(service.GetFlowName(iIList));

//Oservice.BeginSubmitFile10(inEntry, inSubmitData, new MetadataToFillClass[0],callback, asyncState);



service.SubmitFile10(inEntry, inSubmitData, new MetadataToFillClass[0]);

//Oservice.EndSubmitFile10(_result);

}

catch (Exception exc)

{

Console.WriteLine(exc.Message);

break;

}

}

#endregion

}

#endregion

result = service.CloseConnection();

System.Console.WriteLine("CloseConnection result: " + result);

}

finally

{

System.Console.ReadKey();

}

}



public static bool ValidateServerCertificate(

Object sender,

X509Certificate certificate,

X509Chain chain,

System.Net.Security.SslPolicyErrors sslPolicyErrors)

{

if (sslPolicyErrors == (SslPolicyErrors.RemoteCertificateNameMismatch | SslPolicyErrors.RemoteCertificateChainErrors))

{

bool ignore = true;

foreach ( X509ChainStatus status in chain.ChainStatus )

ignore |= (status.Status == X509ChainStatusFlags.UntrustedRoot);

return ignore;

}

else

return false;

}

public static bool TrustAllCertificateCallback(object sender, X509Certificate cert, X509Chain chain, SslPolicyErrors errors)

{

return true;

}





please if any body uses the switch client SDK and faces this problem and can help me please send me

regards

Mostafa
Post Reply