Skip to main content

I am trying to open the connection of K2 server to open the worklist item of a process. but when openning a connection it throws the below error.

 

Error " Value cant be null Parameter Name Token.

 

 

Code snipt is below.

 

private Connection _connection;
private WorklistItem _WorkListItem;

 

protected void Page_Load(object sender, EventArgs e)
{
LoadActions();

}

 

protected LoadActions()

{

SourceCode.Workflow.Client.ConnectionSetup connectionSetup = new SourceCode.Workflow.Client.ConnectionSetup();
connectionSetup.ConnectionParametersm"Authenticate"] = "true";
connectionSetup.ConnectionParametersm"Integrated"] = "true";
connectionSetup.ConnectionParametersm"IsPrimaryLogin"] = "true";
connectionSetup.ConnectionParametersm"Port"] = "5252";
connectionSetup.ConnectionParametersm"SecurityLabelName"] = "K2";
connectionSetup.ConnectionParametersm"UserID"] = Context.User.Identity.Name;
connectionSetup.ConnectionParametersm"WindowsDomain"] = "vvvvvvvvvv";
if (_connection == null)
{
_connection = new Connection();
_connection.Open(connectionSetup);
//_connection.ImpersonateUser(Context.User.Identity.Name);
//_connection.ImpersonateUser("adqcca.farooqi");
}

 

 

}

Hi, AbdulAzizADQC


 


Can you please double check your code sample if is correct.
 Please look into the following link to see if your code is correct.


 


Using SourceCode.Workflow.Client.Connection


 


Also make sure k2 is running


 


 


Kind Regards


 


Julia


Hi,

 

The SourceCode.Workflow.Client API will always run as the current security context, so there is no need for you to specify it again in the ConnectionSetup object. Another note is that you are missing the "Host" parameter. You need to specify the netbios name of the K2 server/cluster you want to connect to.

 

I think in your case, you can just replace the codes with

 

protected void LoadActions()

{

  if(_connection == null)

  {

    _connection = new Connection();

    _connection.Open("blackpearlServerName");

  }

 

  ......

}

 

Do remember to dispose/close the Connection object once you are done with it.

 

 

Cheers!

JK.


I have check the link, still the same error.

 

below is my k2 host server logs.

 

Parameter name: token","","","K2-APP1-DEV:C:Program Files (x86)K2 blackpearlHost ServerBin","4430918","098543daa1704f6a96a5a43ff538a05c",""

"4430928","2014-06-25 15:05:22","Error","General","1","GeneralErrorMessage","K2Worker.AuthenticateIIdentity","1 Value cannot be null.

Parameter name: token","","","K2-APP1-DEV:C:Program Files (x86)K2 blackpearlHost ServerBin","4430928","2f2b627c9171481b9a1714f22ff2d64c",""

 

any idea.


As @jikai pointed out, you are missing a Host parameter.

 

Also, consider using Integrated or Static Authentication in your connection string, then using the Connection.ImpersonateUser() method.


thnx for the sugestion, if anyone can share the code. I have tried everything but no luck. the same error.


I have the same error message for this but this happen on K2 Worklist webpart so I cannot change or check the code within.

 

Any help would be appricated


11331i186C5271F1EB3123.png

Hi all,

I have the same problem... 

 

Code:

Connection k2Conn = new Connection();
SCConnectionStringBuilder scBuilder = new SCConnectionStringBuilder();
scBuilder.Authenticate = true;
scBuilder.IsPrimaryLogin = true;
scBuilder.Integrated = true;
scBuilder.Host = "localhost";
scBuilder.Port = "5252";
k2Conn.Open("localhost", scBuilder); -> execption
...
k2Conn.Close();

 

- This code works in an old VM with MOSS 2007 and an older version of K2 Blackpearl.

- This code works in my current VM in an aspx page.

- This code dont work in my current VM running in a webpart in SharePoint.

 

Cant understand whats happening.... the log dont say nothing helpful.

 

Thanks

 


Hi all,

No one with an advise for this problem??? :(:(


Hi,


 


I recently contacted K2 for the same problem.


They replied me to follow the procedure below. That solved my problem, apparently my K2 server was not configured to work with SharePoint 2013 classic windows claims.


DO NOT FORGET TO BACKUP YOUR K2 DB first!


 


Regards,


Alex


 


 


 


How to configure classic windows claims to work with K2 from SharePoint Claims enabled site with K2 4.6.7


 



  • On your SP box, Open the SharePoint 2013 Management Shell and run the following to get the thumbprint of the SP signing certificate.


(Get-SPServiceApplication -Name SecurityTokenServiceApplication).SigningCertificateThumbprint


 



 


 



  • Open up SQL Server Management Studio
  • Make a backup of your K2 Database

Replace the highlighted thumbprint with the value from the script above and then execute this on your K2 server



DECLARE @issuerId INT


INSERT INTO EK2].NIdentity].dClaimIssuer] (Name,Description, Issuer, Thumbprint, Uri, UseForLogin)


VALUES ('SharePoint Windows STS', 'SharePoint Windows Authentication', 'SharePoint', '7AC848BCA2E9AA552F5051555BD388C45F30FABC',null, 0)


SET @issuerId = SCOPE_IDENTITY();


 


UPDATE

SET IssuerID=@issuerId


WHERE ID=2


 


UPDATE >K2].PIdentity].[ClaimTypeMap]


 SET ClaimType = 'http://schemas.microsoft.com/sharepoint/2009/08/claims/userlogonname'


WHERE ID=3


 


INSERT INTO >K2].RIdentity].]ClaimTypeMap] (ClaimTypeMappingID, ClaimMappingType, OriginalIssuer, ClaimType, ClaimValue)


VALUES (2,'IdentityProviderClaim', 'SecurityTokenService', 'http://schemas.microsoft.com/sharepoint/2009/08/claims/identityprovider', 'windows')


 



 


The K2.Identity.ClaimsIssuer table should hold the new entry


 



  • Restart the server

I'd STRONGLY reccomend opening a support ticket before attempting these steps, as they may not apply to every situation.  The golden rule of "Don't mess with the DB unless K2 support tells you to" still applies.

On the plus side, I get to use this picture twice in one day:

 

12240i792656488E940E33.jpg


Hi


 


Instead of using a classic WebPart in c#, we would like to use a WebService WCF (because we would like to develop our components with javascript libraries such as Vue.js).  We don't get any error when opening the connection to the K2 server but the OpenWorklist() does not return anything (I guess because the identity is lost).


In that case, do we need to setup Kerberos between SharePoint servers and K2 server ?


 


Any help would be highly appreciated 🙂


Reply