I'm trying to get started using 971 les using the client guide. I have generated the client proxies but nowhere do I have an Authentication or OTAuthentication class. Where am I going wrong>
Are you generating client proxies in Java or C#? How have you generated them?
I'm generating java proxies. I generated them using both eclipse and ant and neither gave me an Authentication or OTAuthentication class.
You should be able to run the wsimport command and see the generated class. For example, if I run the following command: (.Net deployment in IIS) wsimport http://localhost/les-services/Authentication.svc?wsdl or (Java deployment in Tomcat) wsimport http://localhost:8080/les-services/services/Authentication?wsdl This creates the Authentication service proxies including the OTAuthentication class. Note that the OTAuthentication class is in a different package from the service. It will be put under com.opentext.ecm.api. If you still don't see it can you run the wsimport command in an empty directory and then send the resulting directory contents? The output of "ls -R" is what I'm looking for, or on windows it would be "dir /S" I believe. Thanks.
Thanks, that worked. Now I'm wondering why it doesn't say that in the client guide :-)
One more question if you don't mind. What class is the constant ECM_API_NAMESPACE in that is referenced in the code below from the client guide?
otAuthElement = header.addHeaderElement( new QName( ECM_API_NAMESPACE, "OTAuthentication" ) );
08/03/2012 15:41
One more question if you don't mind. What class isthe constant ECM_API_NAMESPACE in that is referenced in the code belowfrom the client guide?
otAuthElement = header.addHeaderElement( new QName( ECM_API_NAMESPACE,"OTAuthentication" ) );
Thanks man. I really appreciate the help. Did LAPI for 10 years and trying to get rolling with ews. Thanks again.
Yet another issue. (Always baby steps with OT code) I'm trying to access a user's pws using a previous example from the forum:
The ImpersonateUser() method is part of the Authentication service. To use this method you must currently be authenticated as an Admin user. Calling the ImpersonateUser method will return you a new authentication token for the user you want to impersonate. You can then use this token for the service you want to use as the impersonated user.
Here is a quick example:
// Setup the Authentication service client Authentication.AuthenticationClient authClient = new Authentication.AuthenticationClient();
// You must be an Admin user to use the impersonateUser method // Also a good idea to keep track of the admin token so we can become the admin user again // without having to reauthenticate string adminToken = authClient.AuthenticateUser("Admin", "AdminPassword");
// Set the authentication token as the admin user so we can use the ImpersonateUser method Authentication.OTAuthentication otAuth = new Authentication.OTAuthentication(); otAuth.AuthenticationToken = adminToken;
// Now we can impersonate sgrasley string sgrasleyToken = authClient.ImpersonateUser(otAuth, "sgrasley");
// Setup the DocumentManagement service client DocumentManagement.DocumentManagementClient docManClient = new DocumentManagement.DocumentManagementClient();
DocumentManagement.OTAuthentication docManAuth = new DocumentManagement.OTAuthentication();
// Set the authentication token as the one we got from the ImpersonateUser call docManAuth.AuthenticationToken = sgrasleyToken;
// Create a folder as sgrasley docManClient.CreateFolder(docManAuth, 2000, "sgrasley folder", null, null);
The problem is that I don't have the Authentication.AuthenticationClient option. The only thing I can do is Authentication.Class.
Why do I not have the Authentication.AuthenticationClient option?
Hi Sean,
From your previous posts, i'm pretty sure you're using java. working with SOAP headers is a bit of a pain in java, so the .Net example won't suffice.
Assuming you've run the appropriate wsimport commands, the attached code sample should help you with impersonation
Thanks,
Brad
Hi Brad,
Thanks for the reply. I appreciate your help. Where is the setAdmToken4impersonation() method coming from? Method is undefined if I use the the following line from your attached example:
//get Auth service and set OTAuth HEADER Authentication auth = setAdmToken4impersonation(admToken);
I have all the imports in the example. I don't have the method in ether the OTAuthentication or Authentication classes.
Sean
It’s the 3rd last method in the main.java class (local function)
From: eLink Entry: Content Web Services Forum [mailto:otdncontentwebservices971forum@elinkkc.opentext.com]Sent: Thursday, March 15, 2012 11:39 AMTo: eLink RecipientSubject: Re Re Authentication/OTAuthentication
Re Re Authentication/OTAuthentication
Posted byswalker@celgene.com (Walker, Sean) On 03-15-2012 11:29
[To post a comment, use the normal reply function]
Topic:
Authentication/OTAuthentication
Forum:
Content Web Services Forum
Content Server:
Knowledge Center
Thanks. I totally missed that function. There doesn't happen to be any documentation like there was for LAPI with the methods for each service and and their inputs and outputs is there?
The LAPI/Builder/EWS documentation is available in the start menu exactly how it was in previous releases.
The following link is to the EWS/CWS online documentation which is the same as its installed documentation:
https://knowledge.opentext.com/knowledge/cs.dll?func=ll&objId=19572224
There’s a few handy resources here, including “API Documentation” in javadoc format.
From: eLink Entry: Content Web Services Forum [mailto:otdncontentwebservices971forum@elinkkc.opentext.com]Sent: Thursday, March 15, 2012 2:07 PMTo: eLink RecipientSubject: RE Re Re Authentication/OTAuthentication
RE Re Re Authentication/OTAuthentication
Posted byswalker@celgene.com (Walker, Sean) On 03-15-2012 13:59
Thanks for some reason I get page cannot be displayed when i try to access mine. But once again the documentation is lacking.
I'm trying to login enable an existing disabled user. I have the gist of it:
MemberService memServe = GetService.getMemberService(adminToken);
Member otMember = new Member();
MemberPrivileges memPriv = new MemberPrivileges();
memPriv.isLoginEnabled();
otMember. ????
memServe.updateMember(otMember);
But there's no Member method that accepts a MemberPrivileges object as an arguement. How do I login enable an existing User?
I hate to be such a pain in the neck but it's not as easy as it should be. If I was a full-time employee I could get my company to pay for the OT training but alas I am a mere consultant at this point. Thanks again for your help. I really, really appreciate it.
// current status of login? 5084 is my "testUser"
User wfUser = (User) wfs.getMemberById(5084);
MemberPrivileges privs = wfUser.getPrivileges();
System.out.println("Current Login Enabled status: " + privs.isLoginEnabled());
// flip it!
boolean flip =true;
if (privs.isLoginEnabled()) flip =false;
privs.setLoginEnabled(flip);
wfUser.setPrivileges(privs);
wfs.updateMember(wfUser);
//doublecheck
User wfUser2 = (User) wfs.getMemberById(5084);
MemberPrivileges privs2 = wfUser2.getPrivileges();
System.out.println("Login Enabled status after update: " + privs2.isLoginEnabled());
From: eLink Entry: Content Web Services Forum [mailto:otdncontentwebservices971forum@elinkkc.opentext.com]Sent: Thursday, March 15, 2012 2:53 PMTo: eLink RecipientSubject: RE RE Re Re Authentication/OTAuthentication
RE RE Re Re Authentication/OTAuthentication
Posted byswalker@celgene.com (Walker, Sean) On 03-15-2012 14:48
But! there's no Member method that accepts a MemberPrivileges object as an arguement. How do I login enable an existing User?
Thanks for the reply. I really appreciate your help. Here's my issue though...
Directory Services synchronization runs and disables users in our system. I'm writing a utility that will check their pws to see if they have anything in it before deleting the user account. So when I try to execute the following line of code I am getting 'Could not login with cookie' SOAP exception from the service because the user is not login enabled.
User otUser = (User) otMemSvc.getMemberById(iUserID);
Any suggestions on how to get around this situation?
Checking the contents of disabled users’ workspaces sounds like a job for the Admin user or an account with SysAdmin privs!
With a user that can login and access the target workspace, you can use the DocMan.GetNode(Int NodeID) call using their UserID as the NodeID
From: eLink Entry: Content Web Services Forum [mailto:otdncontentwebservices971forum@elinkkc.opentext.com]Sent: Thursday, March 29, 2012 3:52 PMTo: eLink RecipientSubject: RE RE RE Re Re Authentication/OTAuthentication
RE RE RE Re Re Authentication/OTAuthentication
Posted byswalker@celgene.com (Walker, Sean) On 03-29-2012 15:49
I am using the Admin account. How do you get the user's pws id without impersonating the user? If you try to impersonate the user while the user's account is not login enabled you get an error. Thanks.
The MemberService provides methods to obtain a User and their UserID, which can be used as the DataID of their PWS: getMemberByLoginName(); getSearchResults(); listMembers(); searchForMembers()
From: eLink Entry: Content Web Services Forum [mailto:otdncontentwebservices971forum@elinkkc.opentext.com]Sent: Friday, March 30, 2012 8:14 AMTo: eLink RecipientSubject: RE RE RE RE Re Re Authentication/OTAuthentication
RE RE RE RE Re Re Authentication/OTAuthentication
Posted byswalker@celgene.com (Walker, Sean) On 03-30-2012 08:04
Can I get an example please? The documentation is horrendous.
We met with your CEO for a half hour at Content Day and he said better developer documentation is a priority for him so I'm hoping you guys have an example of how to access a user's pws and get a list of what is there.
Thanks for all the help. I appreciate it.
Hi Sean, Quite a while ago, I pinned a full MemberService example covering all available methods to the top of the forum. You can find that post here:https://knowledge.opentext.com/knowledge/cs.dll?func=ll&objId=17484504&objAction=viewincontainer The methods Brad noted (getMemberByLoginName(), getSearchResults(), listMembers() and searchForMembers()) are all presented in that example. You can use any of those methods to pull back information on a user in the system. Once you have the numeric ID of that user, you can use that same ID as the numeric DataID of the user's personal workspace for any DocumentManagement operations. Regards, Kyle
One other thing I'll note here is the sample I posted in 2010 was against 9.7.1. Any calls that include an authentication token will need a "ref" directive if going against the CS 10 Web Services as the tokens are now passed by reference. The current documentation shows available methods, their prototypes and what the methods accomplish. With an understanding of the available methods, one can chain method calls together to complete a task. In your case, you'd be using a method from the AuthenticationService web service to authenticate with Content Server, the MemberService web service to get the numeric User ID and the DocumentManagement web service to list what is within the workspace. We appreciate any feedback you may have regarding documentation. You noted in your post that the "documentation is horrendous". Can you please clarify what you expect of the documentation so I can pass this information on to the people that maintain that documentation? Thanks, Kyle
Here's a perfect example of where I get frustrated.
I'm trying do a moveNode. I'm fine with the first 3 parameters of the call. the MoveOptions is where I'm running into issues I believe. setAddVersion and setInheritPermissions are self explanatory but setAttrSourceType is not so obvious. It says it's an Enumeration that you set with a Constant value. I've tried several things to get it to work but haven't been successful. I keep getting the oh so informative java.lang.NullPointerException which doesn't really help in figuring out what I'm doing wrong.
Why not have example code?!! A simple moveNode example would save a lot of time and frustration.
Cannot do much to help your frustration but if it is just for your academic interest the call is to be done like this snippet
DocumentManagement.OTAuthentication dmOTAuth = new DocumentManagement.OTAuthentication(); DocumentManagement.MoveOptions mo = new DocumentManagement.MoveOptions(); mo.AddVersion=true; // mo.AttrSourceType=DocumentManagement.AttributeSourceType.ORIGINAL;//it is a ENUM // mo.AttrSourceType = DocumentManagement.AttributeSourceType.DESTINATION;//it is a ENUM did not work // mo.AttrSourceType = DocumentManagement.AttributeSourceType.MERGE; mo.ForceInheritPermissions=true;
As you can see I have commented out the MoveOptions in the call.
The node which I moved using this
dc.MoveNode(ref dmOTAuth, folder.ID, 2102, folder.Name, mo);
The options are actually that the livelink gui shows you when you try to move a node.Many of the websvcs params I undertand by looking at the GUI.I did not have time to debug OT code to see why none of those setting worked that is for another day.BTW the code snippet that I paste used to work about 8 months back and I did this in C# not sure if java expects something else.Perhaps the call is even fixed now.If time permits I will retry that ENUM.
In defence of OT .Everybody said LAPI was riddled with old type code and lo and behold websvcs came.OT is doing the best they can by pushing out samples that work.Just give them a little more time and keep the discussion with some positive vibe:) I am sure as a community that is how it works.
My $0.02
When I work with a LES WS and the documentation is not enough I open the Builder and look at the implementation. The source code is the best documentation - if you can speak OScript-ish ;-) You also debug the WS method that fails to find out why your input argument was not valid - WS methods are usually quite short.
--- Ferda
Guys, thanks for the input. I appeciate the responses.
Unfortunately DocumentManagement.AttributeSourceType.DESTINATION doesn't work in Java.
I'm just getting started in the oscript/builer world so I'm nat that savvy just yet. I'll see if one of my builder gurus here can help me do that.
Thanks again guys.
Thanks! That did the trick. I appreciate all the help.
How do you specify environment information so that you can use the same ot classes for all environments?
My problem is that i run the following to import classes:
wsimport http://lltest:8080/les-services/services/Authentication?wsdl
And connect using:
String strAdminToken = GetService.getAuthenticationToken(id, pwd);
DocumentManagement docMan = GetService.getDMService(strAdminToken);
When I use these classes I can only connect to lltest. To hit prod I need to use classes imported using:
wsimport http://llprod:8080/les-services/services/Authentication?wsdl
There has to be a way to pass in environment info, right?