Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Upload a new version for a document already in ECM

Upload a new version for a document already in ECM

Upload a new version for a document already in ECM

Hi All,

I am trying to implement versioning for ECM documents using OpenText livelink Java api.
I upload a document(w1.txt) to ECM successfully using 'contentServiceClient.uploadContent(new DataHandler(new FileDataSource(filePath)))'

I checked the document in the ECM server, and versioning is enabled for this document. Also I could add new versions of this document(w1.txt) directly from the ECM server.

Also I am able to get the NodeVersionInfo() and VersionNum() of this document correctly from java.

But, when I upload the next version of the document (by the same file name to the same location) from the Java, I am getting "DocMan.DuplicateName : An item with the name 'w1.txt' already exists."

I tried to pass along the version indicator in the SOAP header as below:

String versionContextID = docManClient.addVersionContext(docManClient.getNodeByName(parentID, fileName).getID(), null);

// Create a SOAP header
SOAPHeader header = MessageFactory.newInstance().createMessage().getSOAPPart().getEnvelope().getHeader();

// Add the Version ContextID SOAP header element
SOAPHeaderElement verContextIDElement = header.addHeaderElement(new QName(CORE_NAMESPACE, "versionContextID"));

List<Header> headers = new ArrayList<Header>();

((WSBindingProvider) contentServiceClient).setOutboundHeaders(headers);

But this didn't solve the problem, still getting 'Duplicate item' error (I am adding other headers like 'OTAuthentication' and 'AuthenticationToken', in the same above manner which are working well)
Appreciate if somebody throws some light on this.


RE: Upload a new version for a document already in ECM

Please take a look at a C# sample I have in Java the only changes are the soap headers you will see how a version is being added you can play with it in SOAPUI and make your code. You will get a context from the server and you will upload it to this context.A context is nothing but a cached mechanism in livelink,on first upload the context is usually given the same dataid in livelink but a string.
Oh I thought i had written that in java but actually it is in java perhaps reading that will help


BTW an Item with the same name exists is when a NodeCheck is done to not allow duplicates,so your code is somehow reaching livelink as a call to create
a new node not a version.What you have to do is first make sure you get the existing node,check its subtype to see if it is a 144 and then
do that addversioncontext.I sueect your code is almost correct but missing something very trivial

One more thing I would do is to find if the first node is actually a subtype=144 or 145 if you don't know take the node's dataid and run
select Name,DataID,SubType from DTree where DataID=<Your DataID>

Well, if I called the wrong number, why did you answer the phone?
James Thurber, New Yorker cartoon caption, June 5, 1937
Certified OT Developer,Livelink ECM Champion 2008,Livelink ECM Champion 2010

RE: Upload a new version for a document already in ECM

Thank you appnair for the advice. It is working now, the change made is, added the versionContextID as 'contextID' and not as versionContext.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close