Using HTTP POST to _process XML

Hi There

I hope this the right forum for this question.

According to the Tamino doc, the format of an _process command is:

/[/]?_process=

There are various examples of how to use this using different Tamino APIs and Interactive tools, but nothing on how to use the _process programatically over HTTP.

For example, if I wish to store an XML document (in memory (DOM), not from a file or specified in the URL) into a collection named ‘people’ then my POST request should breakdown as:

URL
HTTP Header
HTTP Body

From Tamino’s point of view, how does the GET version

http://localhost/tamino/my-db/people?_process=<XML object>

get represented as a POST request?

I can guess the URL as http://localhost/tamino/my-db/people

I can also encode my XML doc in the HTTP Body, but how do I notify Tamino about the X-Machine commenad _process or any other X-Machine command? Does it go in the HTTP Header?

Does anyone have any examples?

Thanks
Abdul

Hi Abdul,

I believe all of the API’s use HTTP POST method to communicate to Tamino. In fact at the moment the only communication mechanism to Tamino is via HTTP.

For detailed explaination on HTTP POST in order to do this yourself (which I won’t advise) then there are a couple of RFC’s which you can read:

http://www.ietf.org/rfc/rfc2616.txt (HTTP)
http://www.ietf.org/rfc/rfc1867.txt (form-based file upload in HTML). Tamino accepts multipart/form-data and application/x-www-urlencoded encoded bodies.

As for examples, I may have something somewhere but I would definitely stick to using the provided API’s as they do the difficult HTTP work for you.

If you still need more information please let me know.


Stuart Fyffe-Collins
Software AG (UK) Ltd.

Hi Stuart.

Thanks for your response. We are exploring different ways of invoking and integrating Tamino, especially within Web Services environments.

Yes we can use the APIs, but what if a client does not want the API, or cannot execute it on a particular environment. What would be very useful is the ability to point to a collection using a URL, send an HTTP header containing the X-Machine command (e.g. _process) and send a well-formed XML doc in the HTTP body. This enables any client to send an HTTP call to Tamino.

We’ve looked at the Tamino Interactive Interface and tried to deduce how it’s processing various HTTP POSTs. The IE client sends name=value pairs as the form post, e.g _process= is sent in the body of the post. This is fine, but for transactional HTTP clients it would be better to send the X-Machine command in the header to preserve the HTTP Body as native XML. May be the Tamino API already handles this. We would be interested to know the name of the parameter if this is the case.

This format would certainly be followed by the Tamino SOAP API, which we are exploring at the moment, but again, some clients may not want to install a SOAP Server and require just straight-forward HTTP.

Although we can use the APIs, including the XMLDB, our most likely entry point for Tamino is likely to be HTTP and|or SOAP.

I would be very interested if anyone can say whether Tamino will handle a call in the following syntax from an HTTP client:

URL

location of Tamino Collection+Object

HTTP Header
-----------
name=X-Machine command (e.g. _process)

HTTP Body
---------
XML document

If this is possible then what should the ‘name’ be in the HTTP Header (command, inoCommand???)

Many thanks
Abdul

Hi Abdul,

Let me handle your points one by one.



As an altenative to POST you could use PUT method to insert/update XML documents. The HTTP request would look like:

  
PUT /tamino/mydb/coll/doctype HTTP/1.1
Host: xxxxx
Content-Length: nnnn

<?xml version="1.0"?><a ino:id='7'><b>88</b></a>


The returned HTTP response contains a header called “X-INO-id” containing the value of the assigned ino:id regardless of insert or update (in which case it should match the ino:id in the document as in the above example). If the PUT works you get back a HTTP response 201 (Created) otherwise you get back 400 (Bad Request). In the case of a failure you get back a X-INO-Reason and X-INO-Messageline headers.

Does this help?


Stuart Fyffe-Collins
Software AG (UK) Ltd.