XML2UDDI  目次

Oracle Service RegistryのXML2UDDIデモ・セットでは、Oracle Service RegistryのApplication Programming Interface(API)の機能のデモンストレーションを行い、XML2UDDI APIを使用してXML文書を操作する方法を示します。

このデモ・セットに含まれるデモは次のとおりです。

前提条件および準備手順: コード  目次

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.shrun.bat)と同じディレクトリにあります。XML2UDDIデモのローカル・レベルのプロパティは、次のファイルからロードされます。

Windows: %REGISTRY_HOME%¥demos¥resources¥xml¥env.properties
UNIX: $REGISTRY_HOME/demos/resources/xml/env.properties

表18 デモで使用されるプロパティ

名前デフォルト値説明
uddi.demos.user.john.namedemo_john1人目のユーザーの名前
uddi.demos.user.john.passworddemo_john1人目のユーザーのパスワード
uddi.demos.url.xml2uddihttp://localhost:8888/registry/uddi/xml2uddixml2uddi Webサービス・ポートのURL
uddi.demos.url.securityhttp://localhost:8888/registry/uddi/securityセキュリティWebサービス・ポートのURL

プレゼンテーションおよび機能プレゼンテーション  目次

この項では、すべてのデモで使用されるプログラミング・パターンを、PublishXmlデモを例にして説明します。ソース・コードは次のファイルにあります。

Windows: %REGISTRY_HOME%¥demos¥resources¥xml¥src¥demo¥uddi¥xml¥PublishXml.java
UNIX: $REGISTRY_HOME/demos/resources/xml/src/demo/uddi/xml/PublishXml.java

ヘルパー・メソッドcreatePublishXmlによって、次のようにPublish_xml構造が作成されます。


public Publish_xml createPublishXml(String location, String publishingMethod, String nsPublishMethod, String nsPublishPolicy,
                                               String authInfo) throws InvalidParameterException {
        System.out.println("location = " + location);

        Publish_xml publish = new Publish_xml();
        publish.setLocation(location);
        publish.setPublishingMethod(XmlPublishingMethod.getXmlPublishingMethod(publishingMethod));
        publish.setPolicy(PublishPolicy.getPublishPolicy(nsPublishMethod));
        publish.setNamespacePublishingMethod(NsPublishingMethod.getNsPublishingMethod(nsPublishPolicy));
        publish.setAuthInfo(authInfo);

        return publish;
}
        

publishXmlResourceメソッドによって、次のように公開操作が実行されます。


public XmlResourceDetail publishXmlResource(Publish_xml 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");

        Xml2uddiApi xmlApi = getXml2UddiStub();
        System.out.print("Publishing in progress ...");
        XmlResourceDetail xmlDetail = xmlApi.publish_xml(publish);
        System.out.println(" done");
        return xmlDetail;
}
        

デモのビルドと実行  目次

この項では、Oracle Service RegistryのXML2UDDIデモ・セットをビルドして実行する方法を示します。引き続きPublishXmlデモを使用します。

  1. デモが適切に構成され、Oracle Service Registryが実行中であることを確認してください。

  2. 次のディレクトリに移動します。

    Windows %REGISTRY_HOME%¥demos¥resources¥xml
    UNIX $REGISTRY_HOME/demos/resources/xml

  3. 次のコマンドを使用して、すべてのデモをビルドします。

    Windows: run.bat make
    UNIX: ./run.sh make

    注意注意

    Windowsプラットフォームでデモをコンパイルすると、次のテキストが表示されることがあります。

    A subdirectory or file ..\..\common\.\build\classes already exists.

    . これは予想される現象であり、問題を示すものではありません。

  4. 利用可能なすべてのデモのリストを表示するには、次のコマンドを実行します。

    Windows: run.bat help
    UNIX: ./run.sh help

  5. 選択したデモを実行するには、runコマンドのパラメータにデモの名前を指定して実行します。 たとえば、PublishXmlデモを実行するには、次のように起動します。

    Windows: run.bat PublishXml
    UNIX: ./run.sh PublishXml

    このデモの出力は次のようになります。

    
    Publishing an XML document with the following parameters:
    Enter XML location (URI) [http://localhost:8888/registry/uddi/doc/demos/employees.xml]:
    Enter publishing method (update,create) [update]:
    Enter import publishing policy (automatic,explicit,locations) [automatic]:
    Enter import 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.xml
    Check structure validity .. OK
    Using XML2UDDI at url https://localhost:8443/registry/uddi/xml2uddi .. done
    Publishing in progress ... done
    
    XML http://localhost:8888/registry/uddi/doc/demos/employees.xml
    <xmlResourceDetail xmlns="http://systinet.com/uddi/xml2uddi/v3/5.5">
      <xmlResourceInfo>
        <location>http://localhost:8888/registry/uddi/doc/demos/employees.xml</location>
        <tModelKey xmlns="urn:uddi-org:api_v3">uddi:systinet.com:demo:xml:employees</tModelKey>
        <name xmlns="urn:uddi-org:api_v3">employees.xml</name>
      </xmlResourceInfo>
      <namespace>
        <uri>http://systinet.com/uddi/demo/employeeList</uri>
        <namespaceModel>
          <name xmlns="urn:uddi-org:api_v3">employees.xsd</name>
          <tModelKey xmlns="urn:uddi-org:api_v3">uddi:systinet.com:demo:xsd:employees</tModelKey>
        </namespaceModel>
      </namespace>
    </xmlResourceDetail>
    Logging out .. done