Skip to main content
11-Garnet
November 16, 2021
Solved

ProToolkit ProServerRegister PRO_TK_INVALID_DIR -15

  • November 16, 2021
  • 2 replies
  • 3015 views

Hello,

I am about to connect to the Windchill server by using ProToolkit written in C.

I would like to register new connection to the Windchill server, then create a workspace and commit .asm abd .prt files in to the workspace.

So far, I have this piece of code:

 

ProName server_alias;
ProStringToWstring(server_alias, "Toolkit_TEST_SERVER");

char* server_url = "http://host_name/Windchill";

status = ProServerUnregister(server_alias);

status = ProBrowserAuthenticate(uname, pwrd);

 

ProPath server_url_w;
wchar_t* aliased_url;

wchar_t* workspace_name = L"test-002_15_11_2021";
status = ProStringToWstring(server_url_w, "http://host_name/Windchill");

This is giving me an error:

status = ProServerRegister(server_alias, server_url_w, workspace_name, &aliased_url);

status = PRO_TK_INVALID_DIR(-15)

 

For me it is also odd to provide a name of the workspace, that I am about to create later on?


ProServerWorkspaceData workspaces;
wchar_t* context_name = L"DA.test-002";
status = ProServerworkspacedataAlloc(context_name, workspace_name, &workspaces);

status = ProServerWorkspaceCreate(NULL, workspaces);

status = ProServerActivate(server_alias);

 

Can you help me to resolve this issue? Is this right order to create a workspace and push the files to it? Please, advise me the best approach.

Best answer by YaroslavSin

I think, in ProServerRegister you need use a name of existing "default" workspace (each product, library has workspace by default). After that you can create new one and switch to it. 

2 replies

17-Peridot
November 17, 2021

I think, in ProServerRegister you need use a name of existing "default" workspace (each product, library has workspace by default). After that you can create new one and switch to it. 

Lukasz111-GarnetAuthor
11-Garnet
November 17, 2021

If I use the defaul one, then it works.

In the next steps I got another error message:

wchar_t* context_name = L"DA.test-002";
status = ProServerworkspacedataAlloc(context_name, workspace_name, &workspaces);

status = ProServerWorkspaceCreate(NULL, workspaces);

PRO_TK_CANT_WRITE(-17) - Cannot create a workspace on this server

I am using wcadmin rights.

 

What a reason for that?

 

17-Peridot
November 17, 2021

Maybe, new registered server not active?

Try to use status = ProServerActivate(server_alias); before ProServerWorkspaceCreate. Or set server_alias in ProServerWorkspaceCreate as first argument

 

status = ProServerActivate(server_alias)

wchar_t* context_name = L"DA.test-002";
status = ProServerworkspacedataAlloc(context_name, workspace_name, &workspaces);

status = ProServerWorkspaceCreate(NULL, workspaces);

RPN
18-Opal
November 17, 2021

I don‘t under your order.

 

  1. Register/Configure url and/or alias
  2. login setup with user/pass
  3. register your workspace 
  4. checkout/CheckIn

from the header file:

To automate registration of servers
in interactive mode, use the standard config.fld setup to preregister the
servers. To ensure that the servers are not preregistered when running
Creo Parametric in batch non-graphics mode, set the environment var