import java.util.List;\r
import java.util.UUID;\r
\r
+import javax.jws.WebParam;\r
+import javax.jws.WebResult;\r
import javax.jws.WebService;\r
\r
+import org.codehaus.jra.Get;\r
+import org.codehaus.jra.HttpResource;\r
+\r
import eu.etaxonomy.cdm.remote.dto.NameTO;\r
import eu.etaxonomy.cdm.remote.dto.TaxonSTO;\r
import eu.etaxonomy.cdm.remote.dto.TaxonTO;\r
* Methods adopted from ws_method as \r
* found in http://dev.e-taxonomy.eu/svn/trunk/drupal/modules/cdm_dataportal/cdm_api.module\r
*/\r
-@WebService\r
+@WebService(targetNamespace = "http://cdm.etaxonomy.eu/remote")\r
public interface CdmService {\r
\r
- public NameTO getName(UUID uuid);// throws BusinessLogicException; \r
- \r
- public TaxonTO getTaxon(UUID uuid); \r
+ @Get\r
+ @HttpResource(location = "/whatis/{uuid}")\r
+ public Class whatis(String uuid); \r
+\r
+ @Get\r
+ @HttpResource(location = "/name/{uuid}")\r
+ public NameTO getName(@WebParam(name="uuid") String uuid);// throws BusinessLogicException; \r
\r
- public Class whatis(UUID uuid); \r
+ @Get\r
+ @HttpResource(location = "/taxon/{uuid}")\r
+ public TaxonTO getTaxon(String uuid); \r
\r
- public List<TaxonSTO> listNames(String beginsWith, int page, boolean onlyAccepted, int pagesize);\r
+ @Get\r
+ @HttpResource(location = "/taxa/{beginsWith}/{onlyAccepted}/{pagesize)/{page}")\r
+ public List<TaxonSTO> listNames(\r
+ @WebParam(name="beginsWith") String beginsWith, \r
+ @WebParam(name="onlyAccepted") boolean onlyAccepted, \r
+ @WebParam(name="pagesize") int pagesize, \r
+ @WebParam(name="page") int page);\r
\r
//TODO to be continued .....\r
\r
public class CdmServiceImpl implements CdmService {
- public NameTO getName(UUID uuid) {
- // TODO Auto-generated method stub
- return null;
+ public NameTO getName(String uuid) {
+ NameTO n=new NameTO();
+ n.setFullname("Bella berolina subsp. rosa");
+ n.setUuid(uuid);
+ return n;
}
- public TaxonTO getTaxon(UUID uuid) {
- // TODO Auto-generated method stub
- return null;
+ public TaxonTO getTaxon(String uuid) {
+ TaxonTO t=new TaxonTO();
+ t.setUuid(uuid);
+ return t;
}
- public List<TaxonSTO> listNames(String beginsWith, int page,
- boolean onlyAccepted, int pagesize) {
+ public List<TaxonSTO> listNames(String beginsWith, boolean onlyAccepted, int pagesize, int page) {
// TODO Auto-generated method stub
return null;
}
- public Class whatis(UUID uuid) {
- // TODO Auto-generated method stub
- return null;
+ public Class whatis(String uuid) {
+ return this.getClass();
}
+
}
http://cxf.apache.org/schemas/jaxws.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
- <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/>
<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-http-binding.xml"/>
+ <import resource="classpath:META-INF/cxf/cxf-extension-xml.xml"/>
+ <jaxws:endpoint id="cdmRestWS"
+ implementor="eu.etaxonomy.cdm.remote.service.CdmServiceImpl"
+ address="/xml"
+ bindingUri="http://apache.org/cxf/binding/http">
+ <jaxws:serviceFactory>
+ <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
+ <property name="wrapped" value="true" />
+ </bean>
+ </jaxws:serviceFactory>
+ </jaxws:endpoint>
+
+ <jaxws:endpoint id="cdmJsonWS"
+ implementor="eu.etaxonomy.cdm.remote.service.CdmServiceImpl"
+ address="/json"
+ bindingUri="http://apache.org/cxf/binding/http">
+ <jaxws:serviceFactory>
+ <bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">
+ <property name="wrapped" value="true"/>
+ <property name="properties">
+ <map>
+ <entry key="Content-Type" value="text/plain"/>
+ <entry>
+ <key><value>javax.xml.stream.XMLInputFactory</value></key>
+ <bean class="org.codehaus.jettison.badgerfish.BadgerFishXMLInputFactory"/>
+ </entry>
+ <entry>
+ <key><value>javax.xml.stream.XMLOutputFactory</value></key>
+ <bean class="org.codehaus.jettison.badgerfish.BadgerFishXMLOutputFactory"/>
+ </entry>
+
+ <!--
+ <entry>
+ <key><value>javax.xml.stream.XMLInputFactory</value></key>
+ <bean class="org.codehaus.jettison.mapped.MappedXMLInputFactory">
+ <constructor-arg>
+ <map>
+ <entry key="http://cdm.etaxonomy.eu/remote" value="cdm-remote"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ </entry>
+ <entry>
+ <key><value>javax.xml.stream.XMLOutputFactory</value></key>
+ <bean class="org.codehaus.jettison.mapped.MappedXMLOutputFactory">
+ <constructor-arg>
+ <map>
+ <entry key="http://cdm.etaxonomy.eu/remote" value="cdm-remote"/>
+ </map>
+ </constructor-arg>
+ </bean>
+ </entry>
+ -->
+ </map>
+ </property>
+ </bean>
+ </jaxws:serviceFactory>
+ </jaxws:endpoint>
+
+
<jaxws:endpoint id="hellowWorldService"
implementor="eu.etaxonomy.cdm.remote.service.HelloWorldImpl"
- address="/"
+ address="/hello"
bindingUri="http://apache.org/cxf/binding/http">
<jaxws:serviceFactory>
<bean class="org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean">