+

Search Tips   |   Advanced Search

Resolve SCA references

During application assembly or deployment, a reference (a service dependency) is typically resolved to an actual deployed SCA service.

We can specify the target endpoint of a Service Component Architecture (SCA) reference in any of the following ways:

Use 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, we can optionally include a binding.sca element within a reference element that uses the @target attribute. In an OASIS composite, we 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 we use this approach, remember that use bindings of the same type, meaning that the reference must share a common binding with the service it is targeting.

Use 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.

Use a binding-specific endpoint

We must resolve an SCA reference using a binding-specific endpoint if you invoke non-SCA services over non-default bindings or if we have compatible SCA services that are hosted in another domain.

In general, obtain the binding-specific endpoint from the service provider.

If the 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.

  1. Determine from the service provider whether the service that you are consuming is an SCA service within the same domain as your client.

  2. Determine the binding that the 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.

  3. 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>

  4. Resolve the SCA reference by using a binding-specific endpoint if you are invoking non-SCA services over non-default binding or if we 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 the SCA client's reference to a target service that it will consume.


Related tasks

  • Route HTTP requests to an SCA service when using an external web server
  • Specify bindings in an SCA environment
  • Configure the SCA default binding
  • Use the SCA default binding to find and locate SCA services
  • Configure the SCA web service binding
  • Configure web service binding custom endpoints to support a proxy server
  • Configure EJB bindings in SCA applications
  • Use EJB bindings in SCA applications in a cluster environment
  • Develop SCA services from existing WSDL files
  • Develop SCA services with existing Java code
  • wsimport command for JAX-WS applications
  • Manage policy sets using the administrative console
  • Use Atom bindings in SCA applications
  • Use HTTP bindings in SCA applications

  • Service Component Architecture specifications and APIs