Problem inserting new document with a document name

Hi,

I’m trying to insert a new document into Tamino (version 4.1.1.1) with a document name:

> Start excerpt **********

TStreamAdapter doc = new TStreamAdapter(new StringReader(xml));

if (doc.getDocname() != null && doc.getDocname().length() > 0) {
throw new RuntimeException(“Insert with a document name detected!”);
}

TStreamAccessor streamAccessor = getStreamAccessor(connection);
doc.setDocname(docname); // docname is passed via a parameter !
TStreamAccessor streamAccessor = getStreamAccessor(connection);
InputStream inputStream = streamAccessor.insert(data);

< End excerpt ************

The document is inserted but the ino:docname is missing! What am I doing wrong?

Regards,
Rudolf de Grijs

Hi Rudolf,

I have no idea what is going wrong, from the face of things it should work. I’ve tried with Tamino v4.1.4.1 and the TaminoAPI4J from Tamino v4.1.1.1 and it works fine. For your reference I’ve attached my code.

Regards,

Stuart Fyffe-Collins
Software AG (UK) Ltd.
InsertWithName.java (1.49 KB)

Hi Stuart,

Thank you for your example program.

I found out why my program didn’t work. It thought that I had to add ino:docname to the document, but I found out that this was a wrong assumption.

I also had the same problem with the update. I now do understand that ino:docname (and also ino:id but for other reasons) must be removed, otherwise it will result in a bad request (HTTP response code 400). The documentation states that storing a document with only the document id will result in the loss of the ino:docname, which is indeed the case. But the documentation doesn’t say that the document is rejected when you try to update a document that contains attribute ino:docname (or I must have missed it).

Now everything works ok.

Kind regards,
Rudolf

Hi Rudolf,

I am wondering that you got the HTTP response code 400 if you insert or update a document with an ino:docname. This should not happen and I could not reproduce this behaviour. I was able to update a document that contains attribute ino:docname with the Tamino API for Java as described in the Javadoc.
So I assume there has to be another reason for the rejection.
Can you gibe me more information to this?

Regard,

Oliver Kleber
Software AG