Java Reference
In-Depth Information
may be required than you're used to. Remember that local proxies of remote services
will have the service.imported property set.
Exporting remote services
We're sure you know how to write code for handling errors, so rather than demon-
strating that, we'll skip straight on to ensuring the remote service is available, which is
much more fun.
You'll use a bundle similar to the foreign food department bundle from section 10.3.
The Blueprint for the foreign food service is nearly identical to listing 10.3, but you'll
need to add some extra service properties to tie together the exported service and some
extra SCA configuration:
<service interface="fancyfoods.offers.SpecialOffer">
<entry key="service.exported.interfaces" value="*"/>
<entry key="service.exported.configs" value=""/>
<entry key="" value="ForeignFood"/>
<bean class="fancyfoods.department.foreign.ForeignFoodOffer">
<property name="inventory" ref="inventory"/>
The extra SCA configuration file is exactly the same as that of the client-side bundle
(listing 10.8), and is configured with a similar SCA-Configuration: reference in the
bundle's manifest.
With the new installed in the server-side
framework, if you access http://localhost:8081/foreignfood?wsdl, you'll be able to see
the generated WSDL description for the foreign food service.
Interfaces and services
The process of remoting services using SCA is similar to that of remoting them using
CXF , although SCA does need some extra configuration files. But when you link up the
remote service client to the remote services provider, an important difference
between SCA and CXF becomes clear (see figure 10.24).
Remember that in section 10.2, we mentioned that distribution providers are only
required to support distributed invocations with simple parameter types. Although
CXF allowed you to use interfaces with much more complex parameters, such as Food ,
Tuscany's WSDL binding doesn't. This means the SpecialOffer interface can't easily
be used for Tuscany remote services.
Remoting complex types is often handled by writing an XMLAdapter class to con-
vert between complex and simpler types, and annotating method declarations or
classes with the @XmlJavaTypeAdapter annotation. In the case of Fancy Foods, you'd
add an annotation to the SpecialOffer class, as follows:
Search WWH ::

Custom Search