XML2UDDI  Locate

The Oracle Service Registry XML2UDDI demo set demonstrates the Oracle Service Registry application programming interface's capabilities and shows how to use the XML2UDDI API to manipulate XML documents.

The demos set include the following demos:

Prerequisites and Preparatory Steps: Code  Locate

We expect that you have already installed the Oracle Service Registry and set the REGISTRY_HOME environment variable to the registry's installation location.

To run the Oracle Service Registry's demos, your registry must be running.

It is necessary to configure the demos. The configuration system has two levels: global and local. The properties defined at the global level may be overwritten at the local level. The global properties are located in the file:

Windows: %REGISTRY_HOME%\demos\env.properties
UNIX: $REGISTRY_HOME/demos/env.properties

The values set during the installation of the Oracle Service Registry work out of box, and their modification affects all demos. If you need to redefine the value of some property for a single demo (that is, at the local level), edit env.properties. This file is located in the same directory as the file run.sh (run.bat). Local level properties for the XML2UDDI demos are loaded from the file:

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

Table 18. Properties Used in Demos

NameDefault ValueDescription
uddi.demos.user.john.namedemo_johnfirst user's name
uddi.demos.user.john.passworddemo_johnfirst user's password
uddi.demos.url.xml2uddihttp://localhost:8888/registry/uddi/xml2uddithe xml2uddi web service port URL
uddi.demos.url.securityhttp://localhost:8888/registry/uddi/securitythe security web service port URL

Presentation and Functional Presentation  Locate

This section describes the programming pattern used in all demos using the PublishXml demo as an example. You can find its source code in the file:

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

The helper method createPublishXml creates a Publish_xml structure:

  
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;
}            
        

The publishXmlResource method performs the publishing operation:


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;
}            
        

Building and Running Demos  Locate

This section shows, how to build and run the Oracle Service Registry XML2UDDI demo set. Let us continue with our PublishXml demo.

  1. Be sure that the demos are properly configured and the Oracle Service Registry is up and running.

  2. Change your working directory to

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

  3. Build all demos using:

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

    [Note]Note

    When compiling demos on Windows platforms, you may see the following text:

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

    . This is expected and does not indicate a problem.

  4. To get list of all available demos, run

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

  5. The selected demo can be executed via the run command using the name of the demo as a parameter. For example, to run the PublishWSDL demo, invoke

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

    The output of this demo will resemble the following:

    
    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