Hi Trevor and thanks for taking the time to reply,
Here is the code for my service locator method:
public TXMLObjectAccessor getTXMLObjectAccessor(String uri, String collection) {
TXMLObjectAccessor xmlObjectAccessor = null;
try {
TConnection connection = TConnectionFactory.getInstance().newConnection(uri);
connection.usesLocalTransactionMode();
xmlObjectAccessor =
connection.newXMLObjectAccessor(
TAccessLocation.newInstance(collection),
TJDOMObjectModel.getInstance());
} catch (TServerNotAvailableException e) {
e.printStackTrace();
}
return xmlObjectAccessor;
}
</pre><BR><BR>and here is the code that does the actual access to Tamino:<BR><BR><pre class="ip-ubbcode-code-pre">
public boolean execute() {
OPCServiceLocator service_locator = OPCServiceLocator.getInstance();
//TODO: externalize those two strings
TXMLObjectAccessor xmlObjectAccessor = service_locator.getTXMLObjectAccessor("http://localhost/tamino/prueba_2", "ibermarcreferencec");
TXQuery xquery = TXQuery.newInstance(opcquery.getXQuery() + footer);
System.out.println("----getXQuery------\n" + opcquery.getXQuery() + footer);
try {
TResponse response = xmlObjectAccessor.xquery(xquery, 5);
List list = OPCConvertUtil.convertResponseIntoDisplayableList(response);
if (response.hasQueryContent() && response != null) {
OPCSessionUtil.putTResponseIntoSession(response);
OPCSessionUtil.putSearchResultsIntoSession(list);
}
System.out.println("----hasQueryContent------" + response.hasQueryContent());
return response.hasQueryContent();
} catch (TXQueryException e) {
e.printStackTrace();
return false;
}
}
You mention the need to start a transaction. All I do is that:
connection.usesLocalTransactionMode();
Is that sufficient?
Hoping to get your reply,
Julien Martin.
Software AG Spain
#webMethods#webMethods-Tamino-XML-Server-APIs#API-Management