+

Search Tips   |   Advanced Search

Implement shared scopes in SCA applications that use SDO

We can package the WSDL and XSD files so they can be accessed across various parts of a Service Component Architecture (SCA) application that uses Service Data Objects (SDO) 2.1.1.

Develop one or more SCA composites that use SDO following a top-down approach.

For a top-down development approach, package WSDL and XSD files in an appropriate SCA contribution so the component can access the schema definitions. Read the section on schema registration in SDO data binding for SCA applications for details.

This topic discusses how to package WSDL and XSD files so that they can be accessed across various parts of the application from a shared in-memory instance. The packaging establishes a shared SDO scope. Shared SDO scope is only supported for applications developed on OSOA specifications.

  1. Package the WSDL and XSD files that have schema definitions which to share into a shared contribution JAR file.

  2. In the META-INF/sca-contribution.xml file within the shared contribution JAR file, export the namespaces for which to share schema definitions within SDO scopes.

    To export the namespaces, use the <export namespace="..."> statement.

    The examples in this topic continue the example scenario described in the topic on using SDO 2.1.1 in SCA applications.

    Example META-INF/sca-contribution.xml for mySharedDefs.jar:

    <?xml version="1.0" encoding="UTF-8"?>
    <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
        targetNamespace="http://www.ibm.com/test/soa/sca/sdo/scope/">
      <export namespace="http://www.ibm.com/test/soa/sca"/>
      <export namespace="http://www.ibm.com/test/soa/sca/person"/>
      <export namespace="http://www.ibm.com/test/soa/sca/address"/>
      ...
    </contribution>

  3. For composite applications that reference the shared WSDL and XSD schema definitions, import the desired namespaces from the appropriate META-INF/sca-contribution.xml file.

    Import namespaces from the sca-contribution.xml file of the contribution JAR that contributes the deployable composite which deploys the application components that reference the shared schema definitions as SDO definitions. To import the namespaces, use the <import namespace="..."> statement.

    Example META-INF/sca-contribution.xml for myImportingComposite1.jar:

    <?xml version="1.0" encoding="UTF-8"?>
    <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
        targetNamespace="http://www.ibm.com/test/soa/sca/sdo/scope/"
        xmlns:sdoscope="http://www.ibm.com/test/soa/sca/sdo/scope/">
       <deployable composite="sdoscope:MyShippingComposite"/>
       <import namespace="http://www.ibm.com/test/soa/sca"/>
      <import namespace="http://www.ibm.com/test/soa/sca/person"/>
      <import namespace="http://www.ibm.com/test/soa/sca/address"/>
      ...
    </contribution>

    Example META-INF/sca-contribution.xml for myImportingComposite2.jar:

    <?xml version="1.0" encoding="UTF-8"?>
    <contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"
        targetNamespace="http://www.ibm.com/test/soa/sca/sdo/scope/"
        xmlns:sdoscope="http://www.ibm.com/test/soa/sca/sdo/scope/">
       <deployable composite="sdoscope:MyLoggingComposite"/>
       <import namespace="http://www.ibm.com/test/soa/sca"/>
      <import namespace="http://www.ibm.com/test/soa/sca/person"/>
      <import namespace="http://www.ibm.com/test/soa/sca/address"/>
      ...
    </contribution>


Results

The packaging establishes a shared SDO scope.

Assuming the composites MyShippingComposite and MyLoggingComposite are deployed using the same business-level application, then all SDO references to schema definitions in the namespaces exported from the mySharedDefs.jar file (and imported from the respective JAR files contributing these two composites) are scoped to a common, shared scope associated with the mySharedDefs.jar file. If sharing has not been established through this mechanism, the schema definitions are created separately in each of the two separate scopes associated with the each of the deployable composites.


What to do next

Deploy the files that use SDO in an SCA business-level application.


Related concepts

  • SDO data binding for SCA applications
  • Service Data Objects version 2.1.1
  • Data access with Service DataObjects, API versions 1.0 and 2.01


    Related tasks

  • Use a top-down approach to develop SCA components that use SDO
  • Use SDO 2.1.1 in SCA applications


    Related information: