Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

The URL schema follows a simple pattern :

  • <base service URI> ?method=<operation name>&parm1=<value>&parm2=<value>
Code Block
http://localhost:8085/EchoService?method=echo&msg=Hello RPC

...

This binding will support two styles of wire formats and will be used to control what type of payload will be generated by the service:

  • hardWired : where you hard code the wire format expectations in the composite when configuring the binding. In the example below, service will be using JSON payload.
Code Block
<binding...>
   <wireFormat.json>
</binding...>
  • dynamic : based on Content-Type header for request and Accept header for response. In the case below, the request content will be parsed based on the Content-Type request header and the response payload will be based on the request Accept header.
Code Block
<binding...>
   <wireFormat.dynamic>
</binding...>

...

Let's start by looking on how the component gets defined and configured in the composite file, particularly the following details :

  • binding.rest uri defines the Catalog service endpoint
  • wireFormat.json configure the service to use JSON as the payload
  • operationSelector.jaxrs configure the binding to use JAX-RS annotations to map the HTTP operations to business operations
Code Block
<composite	xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
		xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
		targetNamespace="http://store"
		name="store">
		
	<component name="Catalog">
		<implementation.java class="services.store.FruitsCatalogImpl"/> 
		<property name="currencyCode">USD</property>
		<service name="Catalog">
			<tuscany:binding.rest uri="http://localhost:8085/Catalog">
    		            <tuscany:wireFormat.json />
			    <tuscany:operationSelector.jaxrs />
    		        </tuscany:binding.rest>
   		</service>
		<reference name="currencyConverter" target="CurrencyConverter"/>	
	</component> 
    
	<component name="CurrencyConverter">
		<implementation.java class="services.store.CurrencyConverterImpl"/>
	</component>     

</composite>

...