Still not working WS for querinh proteochache (probably due to interaction with Spring)
authorNatasha Sherstneva <n.shertneva@gmail.com>
Tue, 10 Dec 2013 22:06:53 +0000 (22:06 +0000)
committerNatasha Sherstneva <n.shertneva@gmail.com>
Tue, 10 Dec 2013 22:06:53 +0000 (22:06 +0000)
15 files changed:
WEB-INF/lib/webservices-rt.jar [new file with mode: 0644]
WEB-INF/lib/webservices-tools.jar [new file with mode: 0644]
WEB-INF/sun-jaxws.xml [new file with mode: 0644]
server/compbio/ws/jpred/Jpred.java [new file with mode: 0644]
server/compbio/ws/jpred/JpredClient.java [new file with mode: 0644]
server/compbio/ws/jpred/JpredWS.java [new file with mode: 0644]
server/compbio/ws/jpred/WSPublisher.java [new file with mode: 0644]
server/compbio/ws/jpred/proteocache-WS/Jpred.java [new file with mode: 0644]
server/compbio/ws/jpred/proteocache-WS/JpredClient.java [new file with mode: 0644]
server/compbio/ws/jpred/proteocache-WS/JpredWS.java [new file with mode: 0644]
webapp/compbio/ws/jpred/jaxws/FindSequence.java [new file with mode: 0644]
webapp/compbio/ws/jpred/jaxws/FindSequenceResponse.java [new file with mode: 0644]
webapp/resources/JpredWS.wsdl [new file with mode: 0644]
webapp/resources/JpredWS_schema1.xsd [new file with mode: 0644]
wsbuild.xml [new file with mode: 0644]

diff --git a/WEB-INF/lib/webservices-rt.jar b/WEB-INF/lib/webservices-rt.jar
new file mode 100644 (file)
index 0000000..6741549
Binary files /dev/null and b/WEB-INF/lib/webservices-rt.jar differ
diff --git a/WEB-INF/lib/webservices-tools.jar b/WEB-INF/lib/webservices-tools.jar
new file mode 100644 (file)
index 0000000..e0426b8
Binary files /dev/null and b/WEB-INF/lib/webservices-tools.jar differ
diff --git a/WEB-INF/sun-jaxws.xml b/WEB-INF/sun-jaxws.xml
new file mode 100644 (file)
index 0000000..7cc435f
--- /dev/null
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>\r
+<endpoints xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime' version='2.0'>\r
+       <endpoint name='JpredWS'\r
+               implementation='compbio.ws.jpred.Jpred'\r
+               url-pattern='/JpredWS'/>\r
+</endpoints>\r
diff --git a/server/compbio/ws/jpred/Jpred.java b/server/compbio/ws/jpred/Jpred.java
new file mode 100644 (file)
index 0000000..7d5f586
--- /dev/null
@@ -0,0 +1,13 @@
+package compbio.ws.jpred;
+
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://server.ws.compbio")
+public interface Jpred {
+       
+       public String findSequence(
+                       @WebParam(name = "sequence") String sequence);
+
+}
diff --git a/server/compbio/ws/jpred/JpredClient.java b/server/compbio/ws/jpred/JpredClient.java
new file mode 100644 (file)
index 0000000..ae89eec
--- /dev/null
@@ -0,0 +1,33 @@
+
+/**
+ * Please modify this class to meet your needs
+ * This class is not complete
+ */
+
+package compbio.ws.jpred;
+
+import java.util.Properties;
+
+import javax.xml.ws.Service;
+import javax.xml.namespace.QName;
+
+import java.net.URL;
+
+/**
+ * This class was generated by Apache CXF 2.7.8
+ * 2013-12-09T11:22:58.858Z
+ * Generated source version: 2.7.8
+ * 
+ */
+public class JpredClient {
+
+       public static void main(String[] args) throws Exception {
+               Properties properties = new Properties();
+               properties.setProperty("openejb.embedded.remotable", "true");
+               QName qname = new QName("http://server.ws.compbio", "JpredWS");
+               Service service = Service.create(new URL("http://localhost:1236/proteocache/services"), qname);
+               Jpred sequense = service.getPort(Jpred.class);
+               System.out.println(" : " + sequense.findSequence("MDVQAAPALMLCSATPALRRHGGMTGPVRLSGDIRC"));
+       }
+
+}
diff --git a/server/compbio/ws/jpred/JpredWS.java b/server/compbio/ws/jpred/JpredWS.java
new file mode 100644 (file)
index 0000000..32b5399
--- /dev/null
@@ -0,0 +1,24 @@
+package compbio.ws.jpred;
+
+import javax.jws.WebService;
+
+import compbio.cassandra.CassandraNativeConnector;
+import compbio.statistic.CassandraRequester;
+
+
+@WebService(endpointInterface = "compbio.ws.jpred.Jpred", 
+targetNamespace = "http://server.ws.compbio", serviceName = "JpredWS")
+public class JpredWS implements Jpred {
+
+       @Override
+       public String findSequence(String sequence) {
+               CassandraNativeConnector dbconnector = new CassandraNativeConnector();
+               CassandraRequester cr = new CassandraRequester();
+               System.out.println("YES");
+               if (cr.readProteins(sequence, "whole") != null)
+                       return "The sequence is " + sequence;
+               else
+                       return "No sequence  " + sequence;
+       }
+
+}
diff --git a/server/compbio/ws/jpred/WSPublisher.java b/server/compbio/ws/jpred/WSPublisher.java
new file mode 100644 (file)
index 0000000..f3045cd
--- /dev/null
@@ -0,0 +1,12 @@
+package compbio.ws.jpred;
+
+import javax.xml.ws.Endpoint;
+
+public class WSPublisher {
+       
+       public static void main(String[] args) {
+                  Endpoint.publish("http://localhost:1236/proteocache/services", new JpredWS());
+        
+                  System.out.println("Service is published!");
+           }
+}
diff --git a/server/compbio/ws/jpred/proteocache-WS/Jpred.java b/server/compbio/ws/jpred/proteocache-WS/Jpred.java
new file mode 100644 (file)
index 0000000..7d5f586
--- /dev/null
@@ -0,0 +1,13 @@
+package compbio.ws.jpred;
+
+
+import javax.jws.WebParam;
+import javax.jws.WebService;
+
+@WebService(targetNamespace = "http://server.ws.compbio")
+public interface Jpred {
+       
+       public String findSequence(
+                       @WebParam(name = "sequence") String sequence);
+
+}
diff --git a/server/compbio/ws/jpred/proteocache-WS/JpredClient.java b/server/compbio/ws/jpred/proteocache-WS/JpredClient.java
new file mode 100644 (file)
index 0000000..78d7d95
--- /dev/null
@@ -0,0 +1,37 @@
+
+/**
+ * Please modify this class to meet your needs
+ * This class is not complete
+ */
+
+package compbio.ws.server;
+
+import java.util.Properties;
+
+import javax.xml.ws.Service;
+import javax.xml.namespace.QName;
+
+import java.net.URL;
+
+/**
+ * This class was generated by Apache CXF 2.7.8
+ * 2013-12-09T11:22:58.858Z
+ * Generated source version: 2.7.8
+ * 
+ */
+public class JpredClient {
+
+       public static void main(String[] args) throws Exception {
+               Properties properties = new Properties();
+               properties.setProperty("openejb.embedded.remotable", "true");
+               QName qname = new QName("http://server.ws.compbio", "JpredWSService");
+               Service service = Service.create(new URL("http://localhost:8080/proteocache/services/JpredWS?wsdl"),
+                               qname);
+
+       //      QName qq = service.getServiceName();
+       //      
+               Jpred sequense = service.getPort(service.getPorts().next(), Jpred.class);
+               System.out.println(" : " + sequense.findSequence("erwerw"));
+       }
+
+}
diff --git a/server/compbio/ws/jpred/proteocache-WS/JpredWS.java b/server/compbio/ws/jpred/proteocache-WS/JpredWS.java
new file mode 100644 (file)
index 0000000..15977aa
--- /dev/null
@@ -0,0 +1,22 @@
+package compbio.ws.server;
+
+import javax.jws.WebService;
+
+import compbio.statistic.CassandraRequester;
+
+
+@WebService(endpointInterface = "compbio.ws.server.Jpred", 
+targetNamespace = "http://server.ws.compbio", serviceName = "JpredWS")
+public class JpredWS implements Jpred {
+
+       @Override
+       public String findSequence(String sequence) {
+               CassandraRequester cr = new CassandraRequester();
+               System.out.println("YES");
+               if (cr.readProteins(sequence, "whole") != null)
+                       return "The sequence is " + sequence;
+               else
+                       return "No sequence  " + sequence;
+       }
+
+}
diff --git a/webapp/compbio/ws/jpred/jaxws/FindSequence.java b/webapp/compbio/ws/jpred/jaxws/FindSequence.java
new file mode 100644 (file)
index 0000000..978ffeb
--- /dev/null
@@ -0,0 +1,36 @@
+
+package compbio.ws.jpred.jaxws;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "findSequence", namespace = "http://server.ws.compbio")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "findSequence", namespace = "http://server.ws.compbio")
+public class FindSequence {
+
+    @XmlElement(name = "sequence", namespace = "")
+    private String sequence;
+
+    /**
+     * 
+     * @return
+     *     returns String
+     */
+    public String getSequence() {
+        return this.sequence;
+    }
+
+    /**
+     * 
+     * @param sequence
+     *     the value for the sequence property
+     */
+    public void setSequence(String sequence) {
+        this.sequence = sequence;
+    }
+
+}
diff --git a/webapp/compbio/ws/jpred/jaxws/FindSequenceResponse.java b/webapp/compbio/ws/jpred/jaxws/FindSequenceResponse.java
new file mode 100644 (file)
index 0000000..b53fb20
--- /dev/null
@@ -0,0 +1,36 @@
+
+package compbio.ws.jpred.jaxws;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "findSequenceResponse", namespace = "http://server.ws.compbio")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "findSequenceResponse", namespace = "http://server.ws.compbio")
+public class FindSequenceResponse {
+
+    @XmlElement(name = "return", namespace = "")
+    private String _return;
+
+    /**
+     * 
+     * @return
+     *     returns String
+     */
+    public String getReturn() {
+        return this._return;
+    }
+
+    /**
+     * 
+     * @param _return
+     *     the value for the _return property
+     */
+    public void setReturn(String _return) {
+        this._return = _return;
+    }
+
+}
diff --git a/webapp/resources/JpredWS.wsdl b/webapp/resources/JpredWS.wsdl
new file mode 100644 (file)
index 0000000..98b4f77
--- /dev/null
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is Metro/2.1 (branches/2.1-6728; 2011-02-03T14:14:58+0000) JAXWS-RI/2.2.3 JAXWS/2.2. -->
+<definitions targetNamespace="http://server.ws.compbio" name="JpredWS" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:tns="http://server.ws.compbio" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
+  <types>
+    <xsd:schema>
+      <xsd:import namespace="http://server.ws.compbio" schemaLocation="JpredWS_schema1.xsd"/>
+    </xsd:schema>
+  </types>
+  <message name="findSequence">
+    <part name="parameters" element="tns:findSequence"/>
+  </message>
+  <message name="findSequenceResponse">
+    <part name="parameters" element="tns:findSequenceResponse"/>
+  </message>
+  <portType name="Jpred">
+    <operation name="findSequence">
+      <input wsam:Action="http://server.ws.compbio/Jpred/findSequenceRequest" message="tns:findSequence"/>
+      <output wsam:Action="http://server.ws.compbio/Jpred/findSequenceResponse" message="tns:findSequenceResponse"/>
+    </operation>
+  </portType>
+  <binding name="JpredWSPortBinding" type="tns:Jpred">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
+    <operation name="findSequence">
+      <soap:operation soapAction=""/>
+      <input>
+        <soap:body use="literal"/>
+      </input>
+      <output>
+        <soap:body use="literal"/>
+      </output>
+    </operation>
+  </binding>
+  <service name="JpredWS">
+    <port name="JpredWSPort" binding="tns:JpredWSPortBinding">
+      <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
+    </port>
+  </service>
+</definitions>
+
diff --git a/webapp/resources/JpredWS_schema1.xsd b/webapp/resources/JpredWS_schema1.xsd
new file mode 100644 (file)
index 0000000..7d32d9c
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema version="1.0" targetNamespace="http://server.ws.compbio" xmlns:tns="http://server.ws.compbio" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+  <xs:element name="findSequence" type="tns:findSequence"/>
+
+  <xs:element name="findSequenceResponse" type="tns:findSequenceResponse"/>
+
+  <xs:complexType name="findSequence">
+    <xs:sequence>
+      <xs:element name="sequence" type="xs:string" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="findSequenceResponse">
+    <xs:sequence>
+      <xs:element name="return" type="xs:string" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
+
diff --git a/wsbuild.xml b/wsbuild.xml
new file mode 100644 (file)
index 0000000..17b4995
--- /dev/null
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+
+<project default="main" name="compbio-ws" basedir=".">
+       
+       <!-- java -->
+               <property name="classes" location="${basedir}/WEB-INF/classes" />
+               <property name="lib.path" location="${basedir}/WEB-INF/lib" />
+
+               <path id="classes.path">
+                       <pathelement location="${classes}" />
+               </path>
+
+               <!-- add libraries -->
+               <path id="project.classpath">
+                       <fileset dir="${lib.path}">
+                               <include name="*.jar" />
+                       </fileset>
+               </path>
+
+               <property name="wsdl.dir" location="${basedir}/webapp/resources" />
+               <property name="jpred.wsdl" location="${wsdl.dir}/JpredWS.wsdl" />
+
+               <taskdef name="wsgen" onerror="report" classname="com.sun.tools.ws.ant.WsGen">
+                       <classpath refid="project.classpath" />
+               </taskdef>
+
+               <target name="main">
+                       <!-- TODO this runs file from Eclipse, but with Ant only this need to depends on clean and build! -->
+                       <property name="server.artifacts.dir" location="${basedir}/webapp/compbio/ws/jpred/jaxws/" />
+
+                       <mkdir dir="${server.artifacts.dir}" />
+                       <mkdir dir="${wsdl.dir}" />
+                       <delete quiet="false" verbose="true" failonerror="false">
+                               <fileset dir="${server.artifacts.dir}">
+                                       <include name="*.java" />
+                               </fileset>
+                               <fileset dir="${wsdl.dir}">
+                               </fileset>
+                       </delete>
+
+                       <!-- destdir - Where to put generated classes -->
+                       <!-- sourcedestdir -  Where to put generated source files -->
+                       <!-- resourcedestdir - Where to put generated source files -->
+                       <wsgen sei="compbio.ws.jpred.JpredWS"
+                                       sourcedestdir="${basedir}/webapp"
+                                       destdir="${classes}"
+                                       resourcedestdir="${wsdl.dir}"
+                                       keep="true"
+                                       genwsdl="true"
+                                       extension="false"
+                                       xendorsed="true"
+                                       verbose="true"> 
+                                       <classpath refid="classes.path" />
+                                       <classpath refid="project.classpath" />
+                       </wsgen>
+               </target>       
+       </project>