23.08.2015 Views

Here - Agents Lab - University of Nottingham

Here - Agents Lab - University of Nottingham

Here - Agents Lab - University of Nottingham

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

an interface that on the one hand mimics the original service interface and onthe other hand complies to the asynchronous requirements <strong>of</strong> the middleware,i.e. in the simplest case the internal interface is the asynchronous version <strong>of</strong> theexternal interface. The implementation <strong>of</strong> the provided service is representedby a specic forward mechanism that dispatches the call to the external webservice. To resolve the synchronous/asynchronous mismatch a decoupled invocationcomponent is used. For each service call such an invocation component iscreated, which is solely responsible to perform the synchronous operation. Whilethe operation is pending the invocation component remains blocked but as it hasno other duties than performing the call this is not troublesome. This patternkeeps the wrapper component responsive and lets it accepting concurrent serviceinvocations without having to wait until the previous call has returned.WSDL Wrapper The WSDL wrapper component heavily relies on the existingJAX-WS technology stack. 6 One core element <strong>of</strong> this stack is a tool calledwsimport that is used to automatically generate Java data and service classesfor a given WSDL URL. The generated code can directly be used to invoke theweb service from Java. Based on this generated code the asynchronous serviceinterface has to be manually dened relying on the generated data types forparameters. For this reason no further parameter mappings need to be dened.The wrapper component itself declares a provided service with this interface anduses a framework call to dynamically create the service implementation.REST Wrapper The REST wrapper is based on JAX-RS technology but currentlydoes not employ automatic code generation. 7 Instead, the asynchronouscomponent service interface has to be created manually based on the RESTservice documentation. The interface denition should abstract away from theREST resource architecture and give it a normal object oriented view. The mapping<strong>of</strong> the component service towards the REST service is done with a mappingle represented as annotated interface. This annotated interface containsall methods <strong>of</strong> the original service interface and adds mapping information forthe same types <strong>of</strong> information that already have been used for publishing, i.e.for each method the URL for the REST call, the consumed and produced mediatypes, parameter and result mappings as well as the HTTP method type. Thewrapper component denition is done analogously to the WSDL version withone dierence. Instead <strong>of</strong> using a generated service implementation, the RESTwrapper uses a dynamic proxy that uses the mapping interface to create suitableREST invocations.6 http://jax-ws.java.net/7Automatic code generation can only be used for REST services that supply a webapplication description (WADL le) <strong>of</strong> themselves that represents the pendant to theWSDL le <strong>of</strong> an XML web service. Similar to wsimport, a tool called wadl2java isavailable that is able to create Java classes for data types and services <strong>of</strong> the RESTservice. A problem is that WADL has not reached W3C standard status and also isnot in widespread use in practice.30

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!