Oracle Service RegistryのXSD2UDDIデモ・セットでは、Oracle Service RegistryのApplication Programming Interface(API)の機能のデモンストレーションを行い、XSD2UDDI APIを使用してXSD文書を操作する方法を示します。
このデモ・セットに含まれるデモは次のとおりです。
FindXsd
FindXsdMapping
GetXsdDetail
PublishXsd
UnpublishXsd
Oracle Service Registryがすでにインストールされ、環境変数REGISTRY_HOMEにレジストリのインストール場所が設定されていることを想定しています。
Oracle Service Registryのデモを実行するには、レジストリが実行中である必要があります。
デモを構成する必要があります。構成システムには、グローバルとローカルの2つのレベルがあります。グローバル・レベルで定義されたプロパティは、ローカル・レベルで上書きできます。グローバル・プロパティは、次のファイルにあります。
| Windows: | %REGISTRY_HOME%¥demos¥env.properties |
| UNIX: | $REGISTRY_HOME/demos/env.properties |
Oracle Service Registryのインストール中に設定された値はそのまま使用でき、値の変更はすべてのデモに影響を与えます。単一のデモについて(つまりローカル・レベルで)一部のプロパティの値を再定義する必要がある場合は、env.propertiesを編集してください。このファイルは、ファイルrun.sh(run.bat)と同じディレクトリにあります。XSD2UDDIデモのローカル・レベルのプロパティは、次のファイルからロードされます。
| Windows: | %REGISTRY_HOME%¥demos¥resources¥xsd¥env.properties |
| UNIX: | $REGISTRY_HOME/demos/resources/xsd/env.properties |
表19 デモで使用されるプロパティ
| 名前 | デフォルト値 | 説明 |
|---|---|---|
| uddi.demos.user.john.name | demo_john | 1人目のユーザーの名前 |
| uddi.demos.user.john.password | demo_john | 1人目のユーザーのパスワード |
| uddi.demos.url.xsd2uddi | http://localhost:8888/registry/uddi/xsd2uddi | xsd2uddi Webサービス・ポートのURL |
| uddi.demos.url.security | http://localhost:8888/registry/uddi/security | セキュリティWebサービス・ポートのURL |
この項では、すべてのデモで使用されるプログラミング・パターンを、PublishXsdデモを例にして説明します。ソース・コードは次のファイルにあります。
| Windows: | %REGISTRY_HOME%¥demos¥resources¥xsd¥src¥demo¥uddi¥xsd¥PublishXsd.java |
| UNIX: | $REGISTRY_HOME/demos/resources/xsd/src/demo/uddi/xsd/PublishXsd.java |
ヘルパー・メソッドcreatePublishXsd によって、次のようにPublish_xsd構造が作成されます。
public Publish_xsd createPublishXsd(String location, String publishingMethod, String importMethod, String importPolicy,
String contentMethod, String contentPolicy, String authInfo) throws InvalidParameterException {
System.out.println("location = " + location);
Publish_xsd publish = new Publish_xsd();
publish.setLocation(location);
publish.setPublishingMethod(XsdPublishingMethod.getXsdPublishingMethod(publishingMethod));
publish.setImportPolicy(ImportPublishPolicy.getImportPublishPolicy(importMethod));
publish.setImportPublishingMethod(ImportPublishingMethod.getImportPublishingMethod(importPolicy));
publish.setContentPolicy(ContentPublishPolicy.getContentPublishPolicy(contentPolicy));
publish.setContentPublishingMethod(ContentPublishingMethod.getContentPublishingMethod(contentMethod));
publish.setAuthInfo(authInfo);
return publish;
}
publishXsdResourceメソッドによって、次のように公開操作が実行されます。
public XsdDetail publishXsdResource(Publish_xsd publish) throws UDDIException, SOAPException {
System.out.print("Check structure validity .. ");
try {
publish.check();
} catch (InvalidParameterException e) {
System.out.println("Failed!");
throw new UDDIException(e);
}
System.out.println("OK");
Xsd2uddiApi xsdApi = getXsd2UddiStub();
System.out.print("Publishing in progress ...");
XsdDetail xsdDetail = xsdApi.publish_xsd(publish);
System.out.println(" done");
return xsdDetail;
}
この項では、Oracle Service RegistryのXSD2UDDIデモ・セットをビルドして実行する方法を示します。引き続きPublishXsdデモを使用します。
デモが適切に構成され、Oracle Service Registryが実行中であることを確認してください。
次のディレクトリに移動します。
| Windows | %REGISTRY_HOME%¥demos¥resources¥xsd |
| UNIX | $REGISTRY_HOME/demos/resources/xsd |
次のコマンドを使用して、すべてのデモをビルドします。
| Windows: | run.bat make |
| UNIX: | ./run.sh make |
![]() | 注意 |
|---|---|
|
Windowsプラットフォームでデモをコンパイルすると、次のテキストが表示されることがあります。 A subdirectory or file ..\..\common\.\build\classes already exists. これは予想される現象であり、問題を示すものではありません。 | |
利用可能なすべてのデモのリストを表示するには、次のコマンドを実行します。
| Windows: | run.bat help |
| UNIX: | ./run.sh help |
選択したデモを実行するには、runコマンドのパラメータにデモの名前を指定して実行します。 たとえば、PublishXsdデモを実行するには、次のように起動します。
| Windows: | run.bat PublishXsd |
| UNIX: | ./run.sh PublishXsd |
このデモの出力は次のようになります。
Running PublishXsd demo...
Publishing XML schema with the following parameters:
Enter XSD location (URI) [http://localhost:8888/registry/uddi/doc/demos/employees.xsd]:
Enter publishing method (update,create) [update]:
Enter import publishing policy (all,explicit) [all]:
Enter import publishing method (reuse,create,ignore) [reuse]:
Enter content publishing policy (all,explicit) [all]:
Enter content publishing method (reuse,create,ignore) [reuse]:
Using Security at url https://localhost:8443/registry/uddi/security .. done
Logging in .. done
location = http://localhost:8888/registry/uddi/doc/demos/employees.xsd
Check structure validity .. OK
Using XSD2UDDI at url https://localhost:8443/registry/uddi/xsd2uddi .. done
Publishing in progress ... done
XML Schema http://localhost:8888/registry/uddi/doc/demos/employees.xsd
<xsdDetail xmlns="http://systinet.com/uddi/xsd2uddi/v3/5.5">
<xsdInfo>
<location>http://localhost:8888/registry/uddi/doc/demos/employees.xsd</location>
<namespace>http://systinet.com/uddi/demo/employeeList</namespace>
<tModelKey xmlns="urn:uddi-org:api_v3">uddi:systinet.com:demo:xsd:employees</tModelKey>
<name xmlns="urn:uddi-org:api_v3">employees.xsd</name>
</xsdInfo>
<elements>
<element>
<localName>persons</localName>
<symbolModel>
<name xmlns="urn:uddi-org:api_v3">persons</name>
<tModelKey xmlns="urn:uddi-org:api_v3">uddi:ca43cec0-20f8-11d9-9c6a-1d0743509c6a</tModelKey>
</symbolModel>
</element>
<element>
<localName>person</localName>
<symbolModel>
<name xmlns="urn:uddi-org:api_v3">person</name>
<tModelKey xmlns="urn:uddi-org:api_v3">uddi:ca5e82b0-20f8-11d9-9c6a-1d0743509c6a</tModelKey>
</symbolModel>
</element>
<element>
<localName>department</localName>
<symbolModel>
<name xmlns="urn:uddi-org:api_v3">department</name>
<tModelKey xmlns="urn:uddi-org:api_v3">uddi:ca6a90a0-20f8-11d9-9c6a-1d0743509c6a</tModelKey>
</symbolModel>
</element>
</elements>
<types>
<type>
<localName>persons</localName>
<symbolModel>
<name xmlns="urn:uddi-org:api_v3">persons</name>
<tModelKey xmlns="urn:uddi-org:api_v3">uddi:ca742d90-20f8-11d9-9c6a-1d0743509c6a</tModelKey>
</symbolModel>
</type>
<type>
<localName>person</localName>
<symbolModel>
<name xmlns="urn:uddi-org:api_v3">person</name>
<tModelKey xmlns="urn:uddi-org:api_v3">uddi:ca856ba0-20f8-11d9-9c6a-1d0743509c6a</tModelKey>
</symbolModel>
</type>
<type>
<localName>department</localName>
<symbolModel>
<name xmlns="urn:uddi-org:api_v3">department</name>
<tModelKey xmlns="urn:uddi-org:api_v3">uddi:ca908f30-20f8-11d9-9c6a-1d0743509c6a</tModelKey>
</symbolModel>
</type>
</types>
</xsdDetail>
Logging out .. donee