As part of the Service Oriented Architecture (SOA) that I’m implementing at work, I wanted to investigate setting up a private UDDI so that developers across the country could publish and find any core services. The first hit on Google when searching on the subject is Apache jUDDI, so I started to investigate that (since I love ASF). First thing I notice is that it’s a WAR file, but our platform here is based on ColdFusion, and the standalone installation used in the company couldn’t support implementing it. First thing that pops into my head, of course, is “Let’s look at my old friend, JBoss”.

jUUDI and JBoss Intro

After a quick install of JBoss, I drop in the jUDDI application and immediately run into configuration problems that I won’t bore you with now. However, as I start my research, I very quickly discover that jUDDI is integrated into JBoss! So at this point, the folks at JBoss go up a notch in my esteem.

I then drop the standard jUDDI application from JBoss and copy over the juddi-service.sar to my implemented server and fire it up. First thing I notice is that it’s looking for a JNDI datasource, which I had never set up before, but discover it’s quite simple.

Installing a MySQL UDDI Datastore

  1. Download and install MySQL
  2. Download the 0.9RC4 version of jUDDI
  3. Extract the jUDDI zip and look in the sql directory to get the script for setting up the juddi database
  4. Make sure you have the jboss-local-jdbc.rar package in your JBoss deploy directory
  5. Download the MySQL connector (mysql-connector-java-5.1.5-bin.jar) and put it in the server\lib directory
  6. Create a file named juddi-ds.xml in your deploy directory and create your JNDI datasource.
    Listing 1.1

    <datasources>
       <local-tx-datasource>
          <jndi-name>juddiDB</jndi-name>
          <connection-url>jdbc:mysql://{mysql server ip}:3306/juddi</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>{username}</user-name>
          <password>{password}</password>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>20</max-pool-size>
       </local-tx-datasource>
    </datasources> 
  7. Open up the jboss\server\default\deploy\juddi-service.sar\juddi.war\WEB-INF\jboss-web.xml file and change the jndi-name property to refer to the name you just created
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <!DOCTYPE jboss-web PUBLIC
            "-//JBoss//DTD Web Application 2.3V2//EN"
        "http://www.jboss.org/j2ee/dtd/jboss-web_4_0.dtd">
    
    <jboss-web>
        <context-root>juddi</context-root>
        <resource-ref>
            <res-ref-name>jdbc/juddiDB</res-ref-name>
            <jndi-name>java:/juddiDB</jndi-name>
        </resource-ref>
    </jboss-web>

Ok, so now I’ve got a database set up to store all of the UDDI information… now what? Let’s see if jUDDI started up correctly. I hit http://localhost/juddi and - SHAZAM! - it works: I get a standard “Welcome to JBoss JUDDI” screen. Now I try to publish a service to it. How do I do that?

Some more Googling gets me to the Eclipse Web Services Explorer, which is part of the Web Tools Platform. I install all of the packages and launch the explorer. I test a sample WSDL and it works great, so far so good. Then I try to publish a service to the UDDI and I start getting exceptions in the interface. I check the logs and see the following exceptions …

ERROR [JUDDIServlet] java.lang.IllegalStateException: Failed to load javax.xml.soap.MessageFactory: org.jboss.ws.core.soap.MessageFactoryImpl
ERROR [JUDDIServlet] A serious error has occured while assembling the SOAP Fault.

Back to Google I go and 30 minutes later I finally find some relevant discussions and possible resolutions. What it boils down to is you have to override the org.jboss.ws.core.soap.MessageFactoryImpl class with com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.

How do you do this?

Implementing SOAP with Attachments API for Java (SAAJ)

Go to the SAAJ project site and download the latest SAAJ release. Extract the zip file and copy the two files in the lib directory…

  • saaj-api.jar
  • saaj-impl.jar

to your deploy\lib directory.

Open the jboss\server\default\deploy\properties-service.xml file and set some system properties.

<mbean code="org.jboss.varia.property.SystemPropertiesService"
	 name="jboss:type=Service,name=SystemProperties">

    
    <attribute name="Properties">
      javax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
      javax.xml.soap.SOAPFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl
    </attribute>
</mbean>

Now restart JBoss and try to publish your service again via the Web Services Explorer (or whatever tool you want to use) and it should work.