Sun OpenSSO Enterprise Policy Agent 3.0 Guide for JBoss Application Server 4.x/5.x

ProcedureTo Configure the StockService Sample

  1. Create the wsp directory under /opt.

  2. Download openssowssproviders.zip from the WSS Agent link on https://opensso.dev.java.net/public/use/index.html.

  3. Unzip openssowssproviders.zip in /opt/wsp/.

  4. Create the jboss directory under /opt/wsp/samples for the JBoss Application Server files. For example:

    cd /opt/wsp/samples
    mkdir jboss
  5. Copy the GlassFish sample files to the new jboss directory:

    cp -r /opt/wsp/samples/glassfish/* /opt/wsp/samples/jboss/
  6. Rename glassfish.properties for JBoss Application Server:

    cd /opt/wsp/samples/jboss/
    mv glassfish.properties jboss.properties
  7. In /opt/wsp/samples/jboss/jboss.properties, remove the GlassFish properties and add the following:

    wsp.home=/opt/wsp
    jaxws.home=/opt/jaxws-ri
    jaxws.lib.dir=/opt/jaxws-ri/lib
  8. Edit /opt/wsp/samples/jboss/StockService/build.xml, as shown in the next example.


    Tip –

    To create a new JBoss Application Server build.xml file, just copy the following XML statements.


    <?xml version="1.0" encoding="UTF-8"?> 
    <project name="StockQuoteService" default="all" basedir=".">
      <description>Builds, tests, and runs the project stockclient.</description>
      <property file="../jboss.properties"/>
      <condition property="wsimport-script-suffix" value=".bat">
        <os family="windows"/>
      </condition>
      <condition property="wsimport-script-suffix" value=".sh">
        <not>
          <os family="windows"/>
        </not>
      </condition>
      <path id="build.class.path">
      <pathelement location="build/classes"/>
        <fileset dir="${jaxws.lib.dir}">
          <include name="**/*.jar"/>
        </fileset>
      </path>
      <target name="-pre-compile">
        <mkdir dir="build/classes"/>
        <mkdir dir="web/WEB-INF/classes"/>
        <exec executable="${jaxws.home}/bin/wsimport${wsimport-script-suffix}">
        <arg line="-verbose -d build/classes web/WEB-INF/wsdl/StockService/stockservice.wsdl"/>
        </exec>
        <copy file="src/java/handlers.xml" todir="web/WEB-INF/classes"/> 
      </target> 
      <target name="compile" depends="-pre-compile"> 
        <javac fork="true" destdir="build/classes" srcdir="src/java"> 
          <classpath refid="build.class.path" />
        </javac> 
      </target> 
      <target name ="war" depends="compile">
          <mkdir dir="dist"/> 
        <copy todir="web/WEB-INF/classes"> 
          <fileset dir="build/classes" /> 
        </copy>
        <copy todir="web/WEB-INF/lib"> 
          <fileset dir="${jaxws.lib.dir}"/> 
        </copy>
        <war destfile="dist/StockService.war" webxml="web/WEB-INF/web.xml"> 
          <zipfileset dir="web" />
        </war> 
      </target> 
      <target name="all">
        <antcall target="war" /> 
      </target> 
    </project> 
  9. In the following file, change any references to localhost and port 8080, depending on your deployment:

    /opt/wsp/samples/jboss/StockService/web/WEB-INF/wsdl/StockService/stockservice.wsdl
  10. Remove /opt/wsp/samples/jboss/StockService/web/WEB-INF/sun-web.xml. For example:

    cd /opt/wsp/samples/jboss/StockService/web/WEB-INF
    rm sun-web.xml
  11. In the same directory, create sun-jaxws.xml with the following content:

    <?xml version="1.0" encoding="UTF-8"?>
    <endpoints
      xmlns='http://java.sun.com/xml/ns/jax-ws/ri/runtime'
      version='2.0'>
      <endpoint
        name='StockService'
        implementation='com.samples.StockService'
        url-pattern='/StockService' />
    </endpoints>
  12. In the same directory, in web.xml, add the agent <filter>, <filter-mapping>, <listener>, <servlet>, and <servlet-mapping> entries, as follows:

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/javaee"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
        version="2.5">
    
      <filter>
        <filter-name>Agent</filter-name>
        <filter-class> com.sun.identity.agents.filter.AmAgentFilter </filter-class>
      </filter>
      <filter-mapping>
        <filter-name>Agent</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
       <dispatcher>INCLUDE</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>ERROR</dispatcher>
      </filter-mapping>
    
      <session-config>
        <session-timeout>
          30
        </session-timeout>
      </session-config>
      <welcome-file-list>
        <welcome-file>
          index.jsp
        </welcome-file>
      </welcome-file-list>
    
      <listener>
        <listener-class>
          com.sun.xml.ws.transport.http.servlet.WSServletContextListener
        </listener-class>
      </listener>
    
      <servlet>
        <description>JAX-WS endpoint</description>
        <display-name>The JAX-WS servlet</display-name>
        <servlet-name>jaxws</servlet-name>
        <servlet-class>com.sun.xml.ws.transport.http.servlet.WSServlet</servlet-class>
      </servlet>
      <servlet-mapping>
        <servlet-name>jaxws</servlet-name>
        <url-pattern>/StockService</url-pattern>
      </servlet-mapping>
    </web-app>
  13. Build the StockService WAR file. For example, using ant:

    cd /opt/wsp/samples/jboss/StockService
    /share/builds/components/ant/1.6.5/bin/ant -f build.xml