Saturday, December 26, 2009

ImageMagick

  • Windows7 / VisualStudio 2008 , To build it, get:
  • ftp://ftp.imagemagick.org/pub/ImageMagick/windows/ImageMagick-windows.zip unzip
    When you open, build, and run: VisualMagick/configure/configure.sln
    you get: VisualMagick/VisualStaticMT.sln
    Now you can build ImageMagick.
    To build a release of an exe using ImageMagick, I ran into VisualStudio libraries conflicts using STATIC_MAGICK. I built the "dynamic" ImageMagick using configure, and then I could have it to work fairly easily.
  • To convert pictures using the command line:
    C:\tools\ImageMagick-6.5.8\VisualMagick\bin>convert "C:\Users\x\Downloads\2010-05-16 16.05.43.jpg" -resize 10% toto.jpg
  • Ubuntu
  • $tar xvfz ImageMagick.tar.gz
    $ cd ImageMagick-6.6.3-1
    $ ./configure
    $ make
    $ sudo make install
    ImageMagick-6.7.8-8/utilities/convert DSC_6093.JPG   -resize 40%   out2.jpg

Monday, December 7, 2009

Axis2 Web Service (Tomcat v6)

These are informations that complements
http://people.apache.org/~ruchithf/hw-axis2/
http://www.roseindia.net/webservices/axis2/axis2-client.shtml

  • Install Tomcat6/Axis2 1.5.1 (Axis2 servlet)
    Tomcat configuration on Windows:
    C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\conf\server.xml
  • Install eclipse-jee-galileo-SR1-win32.zip (version 3.5)
    (to be able to build "Dynamic Web Project")
  • install "Service Archive Wizard - Eclipse Plug-in" (aar generation). You can get it from the axis2 page: download/tools

  • Do File/New/"Dynamic Web Project"
    (Target Runtime: "Apache Tomcat v6.0")
  • New Package
  • New ws Class
  • Create a file services.xml in WebContent/META-INF (that is what will be exposed as service features).
  • Create the aar file:
    File/New/Others/AxisServerArchiver
    - "Class File Location": C:\EclipseWorkSpace\MyWs\build\classes\
    - do "not include .class only"
    - Next
    - Skip WSDL
    - Next
    - Next
    - Set the service XML file: "c:\eclipseworkspace\myws\webcontent\meta-inf\services.xml"
    - Next
    - "Ouput file location": C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\axis2\WEB-INF\services
    - WARNING: on Windows 7, eventhough I enter this path, the aar file ends up in
    C:\Users\lefla\AppData\Local\VirtualStore
    not sure why, must be a privilege problem. I have to copy the aar file in the correct folder afterwards.

    Restart Tomcat

    if you did:

    public String echo(String value) {
    return "Hello : " + value;
    }

    You should see the wsdl generated when click on your service from:
    http://127.0.0.1:8082/axis2/services/listServices
    (need to "view source" on the blank page on Chrome browser)

    and also you should see the echo response (with "null" as parameter)
    < ns:echoResponse >
    < ns:return > Hello : null < /ns:return >
    < /ns:echoResponse >
    http://127.0.0.1:8080/axis2/services/myws/echo

  • If you want a Java client for the Axis WS:
    The following command creates the two stubs java files for the client:
    (if you use the -t option, it also generates the client java test source code)
    C:\tmp>wsdl2java -uri http://127.0.0.1:8080/axis2/services/myws?wsdl -o client

  • If you want to use a JSP to connect to the WS
    You can create a new "Dynamic Web Project"
    Reuse the same stub files as in the Java client above in your project
    I had to add httpcore-4.0.jar and berkeleydb-1.5.0.jar (sleepycat collections classes) to the project WebContent/WEB-INF/lib.
    Put your .jsp files in WebContent
    Once done, you can right-click "Export" as a WAR file and put it in
    C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps\MyJspProject.war
    You have to remove the folder MyJspProject in
    C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\webapps
    before restarting Tomcat.
    Look at
    C:\Program Files (x86)\Apache Software Foundation\Tomcat 6.0\logs\localhost.20xx-xx-xx.log to debug

  • Please note the typo in the ruchithf apache tutorial. According to the original echo(String value) command, the associated client instruction should be:
    request.setValue("Hello world");
    and not:
    request.setParam0("Hello world");
  •