XSD2UDDI  Locate

The BEA AquaLogic Service Registry XSD2UDDI demo set demonstrates the BEA AquaLogic Service Registry application programming interface's capabilities and shows how to use the XSD2UDDI API to manipulate XSD documents.

The demos set includes the following demos:

Prerequisites and Preparatory Steps: Code  Locate

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

To run the BEA AquaLogic Service Registry's demos, your registry must be running. To start the BEA AquaLogic Service Registry, execute the serverstart script:

Windows: %REGISTRY_HOME%\bin\serverstart
UNIX: $REGISTRY_HOME/bin/serverstart.sh

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 BEA AquaLogic 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 XSD2UDDI demos are loaded from the file:

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

Table 19. 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.xsd2uddihttp://localhost:8080/uddi/xsd2uddithe xsd2uddi web service port URL
uddi.demos.url.securityhttp://localhost:8080/uddi/securitythe security web service port URL

Presentation and Functional Presentation  Locate

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

Windows: %REGISTRY_HOME%\demos\resources\xsd\src\demo\uddi\xsd\PublishXsd.java
UNIX: $REGISTRY_HOME/demos/resources/xsd/src/demo/uddi/xsd/PublishXsd.java

The helper method createPublishXsd creates a Publish_xsd structure:

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

The publishXsdResource method performs the publishing operation:


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

Building and Running Demos  Locate

This section shows, how to build and run the BEA AquaLogic Service Registry XSD2UDDI demo set. Let us continue with our PublishXsd demo.

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

  2. Change your working directory to

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

  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 PublishXsd
    UNIX: ./run.sh PublishXsd

    The output of this demo will resemble the following:

    Running PublishXsd demo...
    **********************************************************************
    ***              BEA AquaLogic Service Registry Demo - PublishXsd               ***
    **********************************************************************
    
    Publishing XML schema with the following parameters:
    Enter XSD location (URI) [http://localhost:8080/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/uddi/security .. done
    Logging in .. done
    location = http://localhost:8080/uddi/doc/demos/employees.xsd
    Check structure validity .. OK
    Using XSD2UDDI at url https://localhost:8443/uddi/xsd2uddi .. done
    Publishing in progress ... done
    
    XML Schema http://localhost:8080/uddi/doc/demos/employees.xsd
    <xsdDetail xmlns="http://systinet.com/uddi/xsd2uddi/v3/5.5">
      <xsdInfo>
        <location>http://localhost:8080/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