Roland,
I can extract the searchId from the result (i.e. $search_result) and issue a endSearch (i.e. $soap->endSearch($searchId);), but this does not clean things up much. Indeed, "runCompleteSearch()" suggests it should end the search anyway and still doesn't address the connection handler.
Taking your approach of creating another SoapClient object using the JChemSearchWS wsdl (i.e. $soap = new SoapClient('http://myserver.com:8180/axis2/services/ConnectionWS?wsdl'); $soap->close($id); ) and then close it ($soap->close($id);) does not help release the original $id created.
I think what is necessary is that a close() operation needs to be added to JChemSearchWS, or perhaps for the ConnectionWS to attach to a handle created by other WS's, to then use it's close. Of course, if you attempt to close a handle not created by ConnectionWS, you will also crash your app server.
Do you have a suggested work around in the meantime? This seems to be a big show stopper.
The catalina unrecoverable error that results after many calls without "adequate cleanup:"
[ERROR] Data source rejected establishment of connection, message from server: "Too many connections"
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor35.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194)
at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:102)
at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
at org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:131)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
Caused by: com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Data source rejected establishment of connection, message from server: "Too many connections"
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:980)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1102)
at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2142)
at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:773)
at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:348)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:282)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at chemaxon.util.ConnectionHandler.setConnected(ConnectionHandler.java:270)
at chemaxon.util.ConnectionHandler.connect(ConnectionHandler.java:307)
at chemaxon.jchem.webservice.ConnectionProvider.getInstance(ConnectionProvider.java:60)
at chemaxon.jchem.webservice.ConnectionWS.createConnection(ConnectionWS.java:80)
at chemaxon.jchem.webservice.ConnectionWS.getConnection(ConnectionWS.java:61)
at chemaxon.jchem.webservice.JChemSearchWS.getConnectionAndTableInfo(JChemSearchWS.java:111)
... 24 more