19.8. WS-CM Step By Step Instructions

The previous sections detailed all configuration options but it might be easier to follow some simple step by step instructions to set up and deploy a managed web service from scratch:

  1. Create a database
    1. Create a database table with the name METRO_CONFIG:
      CREATE TABLE METRO_CONFIG (id VARCHAR(64) PRIMARY KEY, version BIGINT NOT NULL, config CLOB NOT NULL);
  2. Register the data source (GlassFish in this example)
    1. In the admin console under Resources/JDBC create a connection pool (or use an existing one).
    2. Create a JDBC Resource with the name jdbc/metro/management.
    3. Instead of the GlassFish admin console, you can use the GlassFish asadmin tool from the command line like this:
      $ asadmin create-jdbc-connection-pool --datasourceclassname org.apache.derby.jdbc.ClientDataSource --restype javax.sql.DataSource \\
      --property user=APP:password=APP:portNumber=1527:serverName=localhost:databaseName=metroConfig metro_config_pool
      $ asadmin create-jdbc-resource --connectionpoolid metro_config_pool jdbc/metro/management
  3. Create a web application with a web service
    1. Make sure you are creating a Servlet based web service. Management with JSR 109 web services does not seem to work properly for now. See here for detailed instructions on how to configure a JAX-WS servlet.
    2. Attach a ManagedService policy assertion to the web service port (see next step how this looks like).
    3. Add this to the web.xml:
      <resource-ref>
        <description>Metro Web Services Config Management DB Connection</description>
        <res-ref-name>jdbc/metro/management</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
      </resource-ref>
  4. The Metro configuration for a managed web service would look like this (including the surrounding WSDL service/port elements):
    <service name="NewWebServiceService">
        <port name="NewWebServicePort" binding="tns:NewWebServicePortBinding">
            <wsp:Policy>
                <sunman:ManagedService xmlns:sunman="http://java.sun.com/xml/ns/metro/management"
                                       id="any unique id">
                </sunman:ManagedService>
            </wsp:Policy>
        </port>
    </service>

Terms of Use; Privacy Policy; Copyright ©2013-2014 (revision 20140418.2d69abc)
 
 
Close
loading
Please Confirm
Close