Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

...

  1. 'company repository' = a remote Maven 2 repository used within your company to hold dependencies/artifacts.
  2. Wiki Markup\[Smix_source_folder\] = the location of the folder created after uncompressing the downloaded Smix source distribution (from .zip, .tar.gz etc.).
  3. Wiki Markup\[Servicemix_binary_distribution_home\] = installation location of the Smix binary distribution on your machine

Note: I am using apache-servicemix-3.0-incubating-20060907.104512-15-src.tar.gz for the following tutorial. If you do not use this snapshot release I cannot guarantee the following will work.

...

unmigrated-wiki-markup
Info
iconfalse
titleGetting the Smix dependencies into your company repository

If you want to deploy those dependencies to a company repository then keep reading. I can only give information on doing this for Maven 2 as I did not try this for Maven 1. First go into the top level project pom.xml with you favorite editor. This will be in the \ [Smix_source_folder\]/src folder. You are going to first edit out the references to Maven 1. Search for 'm1', or in another case I searched for 'maven-one'. There was a property and a plug in section I deleted (maybe some other sections also). I think the plug in is the important one to delete/coment out. Next edit the 'distributionManagement' section. Put the relevent information for you company repository here. If you are working with a SNAPSHOT release then you will need to put your snapshot repository information in here.

You should now be able to 'mvn -Dmaven.test.skip=true deploy' and the dependencies will upload to the remote repository you defined. This is a good thing when people you are working with will need the Smix component dependencies. If others will be working on a Smix project you create it will also come in handy, as they will not have to chase down dependencies. THANKS MAVEN!!! I think there are other benefits too, such as faster fetching since the dependencies are more local (physically).

Next up install the compiled binary Servicemix...

...

You now have Smix built from source, and the Smix components in a Maven 2 repository. The built distribution of Smix will be in \ [Smix_source_folder\]/apache-servicemix/target. There will be a source distribution that is like (exactly like?) the one which you downloaded, and the .zip, .tar.gzip binary distributions. Install the binary distribution following the source installation instructions for [Windows|3. Installation#Windows Source Installation] respectively [Unix|3. Installation#Unix Source Installation]. Once you have installed the binary Servicemix installation you are ready to do some testing.

wsdl-first

Wiki MarkupThe first thing to do now is install the [wsdl-first|1. Quick start#Deploy a sample application] service assembly (SA) which contains a few service units (SU's) ([see JBI specification document|https://sdlc6a.sun.com/ECom/EComActionServlet;jsessionid=728961EE41294F2FB2547B82D037F02E]). The end result is a XFire based SOAP service which is pretty simple. The actual code for the service is in the file \document). The end result is a XFire based SOAP service which is pretty simple. The actual code for the service is in the file [Servicemix_binary_distribution_home\]/examples/wsdl-first/wsdl-first-jsr181-su/src/main/java/org/apache/servicemix/samples/wsdl_first/PersonImpl.java. Phew\! Take a look at the code, it is pretty simple. It uses an [annotation|http://java.sun.com/j2se/1.5.0/docs/guide/language/annotations.html] which describes the class as a [jsr181|http://dev2dev.bea.com/webservices/jwsm.html] web service. One interesting thing to note about this project is the use of an ant task inside the parent pom.xml. This task uses XFire's WsGenTask to create Java objects used by the web service, as described in the WSDL file.

Info
iconfalse
titleAbout this example

This example is a good starting place if you are interested in creating a SOAP service in Smix. After reviewing the full code you should have a grasp on creating a simple POJO web service.

...

So let's get this up and running in our Smix container. [Start|1. Quick start#Start the server] Smix, watch the output to make sure things start up correctly. You will need to open up a new console for the next step, since the Smix output is taking up the other. You will be able to watch this output to see what is going on in some of the following steps. Go back to \ [Servicemix_binary_distribution_home\]. You need to copy the components needed by the wsdl-first SA from the /components folder to the /install folder. The ones you should copy are:

  • servicemix-http-3.0-incubating-SNAPSHOT-installer.zip
  • servicemix-shared-3.0-incubating-SNAPSHOT-installer.zip
  • servicemix-jsr181-3.0-incubating-SNAPSHOT-installer.zip

With each copied component will come messages from Smix in the console output window. Watch these to make sure things properly install. If any problems crop up, try to copy the component again. I have received a zip related exception before. I did the copy a second time and the problem didn't show itself a second time.unmigrated-wiki-markup

There is an easy way to do the following: copy the file \ [Servicemix_binary_distribution_home\]/examples/wsdl-first/wsdl-first-sa-3.0-incubating-SNAPSHOT.zip into the /install folder. Watch the Smix console window making sure things go well. You can now open a browser and go [here|http://localhost:8192/PersonService/main.wsdl] to see the WSDL for the SOAP service.

Wiki MarkupThat was the easy way....but you want to learn about developing so let's do it the 'hard' way. First go to the \ [Servicemix_binary_distribution_home\]/examples/wsdl-first folder and type mvn install. This example project is using a [Maven 2 plugin|Maven JBI plugin] for creating specific JBI components. If you look in the module pom.xml files you will see a special packaging type. After the mvn install completes there will be file called wsdl-first-sa-3.0-incubating-SNAPSHOT-installer in the wsdl-first-sa module's target folder. This is the SA for the wsdl-first example project. Now we want to deploy this to our container. The Maven JBI plugin will take care of this for us\!\!\! Note we need to make a small change to the wsdl-first-sa module's pom.xml. The plugin will normally try to install all the shared libraries needed by the SA when running the Maven goal jbi:projectDeploy. This is sometimes useful. But often it causes problems because another SA in Smix is using the shared lib already. In this case the Maven goal will try to remove and redeploy the shared lib from Smix. This causes a problem and will make the SA deployment fail. So to tell the plugin to not do this make the following change in the pom.xml:

No Format
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.servicemix.tooling</groupId>
            <artifactId>jbi-maven-plugin</artifactId>
            <extensions>true</extensions>
        </plugin>
    </plugins>
</build>

...

That little config change will prevent some headaches later.unmigrated-wiki-markuplater.

You are ready to rock. Change directory to the wsdl-first-sa module. Type 'mvn jbi:projectDeploy'. You can watch the Smix console for information on the deployment.!wsdl-first-install.jpg|align=center! &nbsp; Betting that all went well you should be ready to test out the web service you deployed into Smix. Lucky for you a nice little web app has been packaged with the application. In your web browser open the file \deployment.Image Added
 
Betting that all went well you should be ready to test out the web service you deployed into Smix. Lucky for you a nice little web app has been packaged with the application. In your web browser open the file [Servicemix_binary_distribution_home\]/examples/wsdl-first/client.html. This static .html page contains a javascript which will try to contact the web service on your local machine. To make it work simply click the 'send' button. If your browser issues any warning make sure you allow the javascript to do what it needs to do. In Firefox I have to 'allow' what it calls an unsafe operation. The results of clicking the 'send' button will be a SOAP response posted into the right hand text area.

Temporary excursion into monitoring

...