Hello!
If my tamino database is closed and then in IE6 I execute the following command:
http://localhost/tamino/mydb/col?_xql=count(/doc)
then I get the following message text:
–
<?xml version="1.0" ?>
- <ino:response xmlns:ino=“http://namespaces.softwareag.com/tamino/response2”>
- <ino:message ino:returnvalue=“8201”>
<ino:messagetext ino:code=“INOXHE8201”>Can’t connect to server on host localhost at port 3273, TCP error code 10061.</ino:messagetext>
</ino:message>
</ino:response>
–
So, error code is 8201.
However using TaminoClient I get:
error code 8400.
How can I get the same error code like in IE?
Thanks in advance!
best regards,
Dariusz Baumann
PS.
Here is my sample code:
--------------------------
import com.softwareag.tamino.API.dom.TaminoClient;
import com.softwareag.tamino.API.dom.TaminoError;
import com.softwareag.tamino.API.dom.TaminoResult;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
public class Example {
private
TaminoClient tc;
TaminoResult tr;
Document dc;
Element el;
int count;
String REQUEST_OBJECT_NO = “XQL Request processed, no object returned”;
String REQUEST_OBJECT_YES = “XQL Request processing”;
public String getNodeValueTamino(Element el, String ls_tagname, int idx) {
Element el_parent = (Element)el.getChildNodes().item(idx);
String ls = “”;
try {
Element el_child = (Element)el_parent.getElementsByTagName(ls_tagname).item(0);
ls = el_child.getChildNodes().item(0).getNodeValue();
}
catch (java.lang.NullPointerException ex) {
ls = ex.getMessage();
}
return ls;
}
public Element getElementTamino() {
return el;
}
public int getMessageTamino(Document dc_ino) {
Element el_parent = (Element)dc_ino.getElementsByTagName(“ino:message”).item(0);
Element el_child = (Element)el_parent.getElementsByTagName(“ino:messageline”).item(0);
String ino_message_line = el_child.getFirstChild().getNodeValue();
if (ino_message_line.equals(REQUEST_OBJECT_NO))
return -1;
else {
String ls_returnValue = el_parent.getAttributeNode(“ino:returnvalue”).getFirstChild().getNodeValue().toString();
int returnValue = Integer.parseInt(ls_returnValue);
if (returnValue == 0) {
el = tr.getElement();
}
return returnValue;
}
}
public int getCount() {
return count;
}
public int getCountTamino(String ls_url, String ls_doc, int i_ps) {
try {
tc = new TaminoClient(ls_url);
tc.setPageSize(i_ps);
tc.startSession();
tr = tc.query(“count(/”+ls_doc+“)”);
Element el_c = (Element)tr.getElement();
count = Integer.parseInt(el_c.getFirstChild().getNodeValue());
tc.endSession();
return 0;
}
catch (com.softwareag.tamino.API.dom.TaminoError error) {
return error.responseCode;
}
}
public int getDataTamino(String ls_url, String ls_doc, int i_ps) {
try {
tc = new TaminoClient(ls_url);
tc.setPageSize(i_ps);
tc.startSession();
tr = tc.query(ls_doc);
Document dc = tr.getDocument();
int ret = getMessageTamino(dc);
tc.endSession();
return ret;
}
catch (com.softwareag.tamino.API.dom.TaminoError error) {
return error.responseCode;
}
}
public static void main(String arg) {
Example example = new Example();
int i_pagesize = 0;
String s_url = “http://localhost/tamino/mydb/col”;
String s_doc = “doc”;
int i_value = example.getCountTamino(s_url, s_doc, i_pagesize);
if (i_value == 0) {
int i_count = example.getCount();
System.out.println(“RECORD_COUNT = " +Integer.toString(i_count));
int i_retValue = example.getDataTamino(s_url, s_doc, i_pagesize);
if (i_retValue == 0) {
Element el_tamino = example.getElementTamino();
for (int i=0; i<i_count; i++) {
String ls_id = example.getNodeValueTamino(el_tamino, “id_client”, i);
String ls_surname = example.getNodeValueTamino(el_tamino, “surname”, i);
System.out.println(Integer.toString(i)+”, ID = " +ls_id+", SURNAME = " +ls_surname);
}
}
else {
System.out.println("ERROR CODE (data) = " +Integer.toString(i_retValue));
}
}
else {
System.out.println("ERROR CODE (count) = " +Integer.toString(i_value));
}
}
}
--------------------------
Hi Dariusz,
The TaminoClient throws error 8400 whenever a databases is not accessible, which could be when the database is offline and/or the web server is offline. Whenever there is a communication error, the response will always be 8400 as far as the API is concerned.
The API checks the response from Tamino and if it is 8202 it throws a TaminoError with error code 8400 - so this “feature” is built into the API itself. IMHO I think it is correct that a common error number should be given in the event of a communication error. The field errorText of TaminoError then provides a specific error.
Best regards,
Stuart Fyffe-Collins
Software AG (UK) Ltd.
http://localhost/tamino/my1db/col?_xql=doc
ino:returnvalue=“8202”>
Tamino database unknown: my1db
http://localhost/tamino/mydb/c1ol?_xql=doc
ino:returnvalue=“8811”
Collection name not found
Collection name = c1ol
Unfortunately, in these above queries TaminoError always return 8400. Why?
best regards,
Dariusz Baumann
Hi Dariusz,
The API does not change response 8811 into 8400; in fact the TaminoError exception is not raised at all. The only time error 8400 occurs is if there is really is a connection problem. I tried this with Tamino v3121.
Regards,
Stuart Fyffe-Collins
Software AG (UK) Ltd.