You can package your 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.
Before you begin
Develop one or more SCA composites that use SDO following
a top-down approach.
If you are using a top-down development
approach, you must 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.
About this task
This topic discusses how to package WSDL and XSD files
so that they can be accessed across various parts of your 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.
Procedure
- Package the WSDL and XSD files that have schema definitions
which you want to share into a shared contribution JAR file.
- In the META-INF/sca-contribution.xml file
within the shared contribution JAR file, export the namespaces for
which you want 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>
- 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 your files that use SDO in an SCA business-level
application.