-
Notifications
You must be signed in to change notification settings - Fork 1
The Web Service Client
The web service client's source is in the Maven module myequivalents/myequivalents-wscli. You can link this module into your project the same way you do it for the core package, the only difference is that 'myequivalents-core' is replaced by 'myequivalents-wscli'.
##Configuration As usually, you should configure the web service client by means of a Spring bean configuration file:
<?xml version="1.0" encoding="UTF-8"?>
<!--
This is specifically used by the automated tests in the web service client module. myeq-manager-config.xml is instead
used to setup the web server. This is the easiest arrangement via Maven overlays.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation=
"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"
>
<!--
This is a Spring Framework resource configuration file (see http://static.springsource.org/spring/docs/3.2.x/spring-framework-reference/html/beans.html).
The MyEquivalents applications get the managers (i.e. components needed to access the service and its back-end) via
the factory configured by this bean. See documentation and test classes in the core package for details.
-->
<bean id="myEquivalentsManagerFactory" class="uk.ac.ebi.fg.myequivalents.webservices.client.WSClientManagerFactory">
<constructor-arg type="java.lang.String" value="http://localhost:8080/myequivalents/ws" />
</bean>
</beans>
##Usage examples
The client can be used as shown in the JUnit tests:
// /myequivalents is the application name (see previous section)
// /ws is the prefix configured by myequivalents-web/src/main/webapp/WEB-INF/web.xml
// and in most cases there is no need to change that
EntityMappingManager mmgr = new EntityMappingWSClient ( "http://www.yourserver.net:8080/myequivalents/ws" );
EntityMappingSearchResult result = mmgr.getMappings ( false, "test.testweb.service6:acc1", "test.testweb.service6:acc2" );
// EntityMappingSearchResult is the same class shown in the other examples above
As you can see, the requests syntax for the web service is the same as the one used with the core API. As explained in the introduction, at the moment only the getMappings request is implemented.
'''TODO''': as you can see above, for the moment the managers for the web service client are created directly. This will change soon, for coherence and other practical reasons, we will change the code so that this module too will use the Spring-based approach, described elsewhere. For instance, this will allow one to configure a client that has a local cache, or some other filtering.