import java.io.IOException;\r
import java.io.PrintWriter;\r
import java.net.ConnectException;\r
+import java.net.MalformedURLException;\r
+import java.net.URL;\r
import java.util.Arrays;\r
import java.util.List;\r
+import java.util.logging.Level;\r
\r
+import javax.xml.ws.Service;\r
import javax.xml.ws.WebServiceException;\r
\r
import compbio.data.msa.JABAService;\r
">Foo\nC-UUGCGUUAAUGAGAACAGAAACG-UAAA--CUAUAA-CCUAG-G-GGUUUCUGUUGGAUGGUUG----GCAAC\n"\r
+ ">Bar\nG-UGGCGCUUAUGACGCAGUUGUCU-UAAA-CUCGAAC--UCGA-GCGGGCAAUUGCUGAU-UACGAUUAACCAC\n";\r
\r
+ public static final String clustalRNAAlignment = \r
+ "CLUSTAL\n" +\r
+ "Foo C-UUGCGUUAAUGAGAACAGAAACG-UAAA--CUAUAA-CCUAG-G-GGUUUCUGUUGGA\n" +\r
+ "Bar G-UGGCGCUUAUGACGCAGUUGUCU-UAAA-CUCGAAC--UCGA-GCGGGCAAUUGCUGA\n" +\r
+ "Foo UGGUUG----GCAAC\n" +\r
+ "Bar U-UACGAUUAACCAC";\r
/**\r
* Status strings\r
*/\r
\r
private <T> boolean testSequenceAnnotationWS(\r
SequenceAnnotation<T> wservice, Services service) throws Exception {\r
- writer.print("Calling analyse.........");\r
+ writer.print("Calling annotation test.........");\r
\r
List<FastaSequence> input = loadSeqs(2);\r
if (service == Services.AAConWS ) {\r
\r
private void reportException(Exception e) {\r
writer.println(FAILED);\r
- writer.println("Exception while waiting for results. "\r
- + "Exception details are below:");\r
+ writer.println("Exception while waiting for results. Exception details are below:");\r
writer.println(e.getLocalizedMessage());\r
e.printStackTrace(writer);\r
}\r
}\r
\r
}\r
+ \r
+ /**\r
+ * Connects to a web service by the host and the service name web service type\r
+ * \r
+ * @param host\r
+ * the fully qualified name of JABAWS server including JABAWS\r
+ * context name e.g\r
+ * http://nanna.cluster.lifesci.dundee.ac.uk:8080/jaba\r
+ * @param service\r
+ * the name of the JABAWS service to connect to\r
+ * @return JABAService<T>\r
+ * @throws WebServiceException\r
+ * @throws ConnectException\r
+ * if fails to connect to the service on the host\r
+ */\r
+ private JABAService connect(String host, Services service)\r
+ throws WebServiceException, ConnectException {\r
+ URL url = null;\r
+ System.out.println ("Attempting to connect with " + service.toString() + "...");\r
+ try {\r
+ url = new URL(host + "/" + service.toString() + "?wsdl");\r
+ System.out.println ("URL: " + url.toString());\r
+ } catch (MalformedURLException e) {\r
+ e.printStackTrace();\r
+ }\r
+ Service serv = null;\r
+ try {\r
+ serv = service.getService(url, service.getServiceNamespace());\r
+ } catch (WebServiceException wse) {\r
+ wse.printStackTrace();\r
+ }\r
+ if (serv == null) {\r
+ throw new ConnectException("Could not connect to " + url + ". Is the server down?");\r
+ }\r
+ JABAService srv = service.getInterface(serv);\r
+ System.out.println ("Connected successfully!");\r
+ return srv;\r
+ }\r
\r
/**\r
* Test JABA web service\r
*/\r
public boolean checkService(Services service) throws ConnectException,\r
WebServiceException {\r
- JABAService ws = Jws2Client.connect(hostname, service);\r
+ JABAService ws = connect(hostname, service);\r
if (ws == null) {\r
String line = "Cannot estabilish the connection to host " + hostname + " with service ";\r
writer.println(line + service.toString());\r