During application assembly or deployment, a reference
(a service dependency) is typically resolved to an actual deployed
SCA service.
About this task
You can specify the target endpoint of a Service Component
Architecture (SCA) reference in any of the following ways:
- Using the @target attribute on the reference element in order
to target a reference to a component service within the domain
- For OASIS composites, using the @target
attribute of the binding.ws element to target a web
service reference to an SCA web service within the domain
- Using the @uri attribute of the binding element to specify a binding-specific
endpoint
- Using the @target attribute on the reference element
Use this option when the target service is another SCA service
that is in the same domain as the client component, or rather, the
component with the reference.
This @target
attribute is supported for binding.sca for both OSOA
and OASIS composites. In an OSOA composite, you can optionally include
a binding.sca element within a reference element
that uses the @target attribute. In an OASIS composite, you cannot
include a binding.sca element within a reference
element that uses the @target attribute.
The @target attribute
is supported for the following bindings for OSOA composites only:
- binding.ws
- binding.atom
- binding.http
- binding.json
When a reference uses the @target attribute, the client
does not need to know the endpoint address of a service. It is determined
during run time. Also, the @target attribute does not need to be updated
when the target service is deployed to a new server with a different
address.
If you use this approach, remember that you must use
bindings of the same type, meaning that the reference must share a
common binding with the service it is targeting.
- Using the @target attribute on the binding.ws element
- Use this option to wire an SCA web service reference to an SCA
web service within the same domain.
This option is supported for
OASIS composites only.
- Using a binding-specific endpoint
You must resolve an SCA reference using a binding-specific
endpoint if you invoke non-SCA services over non-default bindings
or if you have compatible SCA services that are hosted in another
domain.
In general, obtain the binding-specific endpoint from
the service provider.
If your target service is another SCA
service, see the documentation for configuring the particular SCA
binding to learn more about which binding-specific endpoint is used
for a given service deployment over a particular binding.
Procedure
- Determine from the service provider whether the service
that you are consuming is an SCA service within the same domain as
your client.
- Determine the binding that your client uses to consume
this service.
If the target service is an SCA service,
the binding that you use is based on the bindings over which the service
is exposed. If the service is not an SCA service, the binding depends
on the technology over which the service is provided. For example,
services offered over SOAP/HTTP use the SCA web services binding.
- If the SCA service is hosted in the same domain as your
client, use the @target attribute to resolve a reference to a component
service within the domain.
The following examples demonstrate
using the @target attribute. The syntax for the
<reference> element
is the same for the different SCA binding types.
- SCA default binding
Target component
<component name="TargetComponent">
<service name="BankService"/>
</component>
Client component
<component name="ClientComponent">
<reference name="myReference" target="TargetComponent"/>
</component>
- SCA web service binding
Target component
<component name="TargetComponent">
<service name="BankService">
<interface.wsdl ….>
<binding.ws/>
</service>
</component>
Client component (OSOA example)
<component name="ClientComponent">
<reference name="myReference" target="TargetComponent">
<interface.wsdl ….>
<binding.ws/> <!-- The client does not have to specify endpoint details. -->
</reference>
</component>
Client
component (OASIS example)
<component name="ClientComponent">
<reference name="myReference">
<interface.wsdl ….>
<binding.ws target="TargetComponent"/>
</reference>
</component>
- SCA Atom binding
Target component
<component name="NewsServiceComponent">
<service name="NewsService">
<t:binding.atom uri="/newsService"/>
</service>
</component>
Client component
<component name="NewsComponent">
<reference name="newsServiceRef" target="NewsServiceComponent/NewsService">
<t:binding.atom/> <!-- The client does not need to specify endpoint details -->
</reference>
</component>
- SCA HTTP binding
Target component
<component name="Catalog">
<service name="Catalog">
<t:binding.http>
<t:wireFormat.jsonrpc/>
</t:binding.http>
</service>
</component>
Client component
<component name="Store">
<t:implementation.widget location="store.html"/>
<reference name="catalog" target="Catalog/Catalog">
<t:binding.http/> <!-- The client does not need to specify endpoint details -->
<t:wireFormat.jsonrpc/>
</t:binding.http>
</reference>
</component>
- Resolve the SCA reference by using a binding-specific endpoint
if you are invoking non-SCA services over non-default binding or if
you have compatible SCA services that are hosted in another domain.
The following examples demonstrate using the binding-specific
endpoint for the client component:
- SCA web service client component
<component name="ClientComponent">
<reference name="myReference">
<!-- The exact URL is obtained from a service provider. -->
<binding.ws uri=”http://www.mybank.com:9080/MyBank/AccountService/services>
</reference>
</component>
- SCA binding.atom client component
<component name="Aggregator">
<reference name="atomFeed1">
<t:binding.atom
uri="http://www.ibm.com/developerworks/views/webservices/rss/libraryview.jsp"/>
</reference>
</component>
- SCA binding.http client component
<component name="Store">
<reference name="catalog">
<t:binding.http uri="/catalog">
<t:wireFormat.jsonrpc/>
</t:binding.http>
</reference>
</component>
See the documentation for configuring the particular SCA binding
to learn more about binding-specific endpoint resolution for these
SCA binding types.
Results
You have identified your SCA client's reference to a target
service that it will consume.