Return-Path: Delivered-To: apmail-ws-axis-dev-archive@www.apache.org Received: (qmail 9825 invoked from network); 25 Apr 2007 10:40:27 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Apr 2007 10:40:27 -0000 Received: (qmail 74131 invoked by uid 500); 25 Apr 2007 10:40:33 -0000 Delivered-To: apmail-ws-axis-dev-archive@ws.apache.org Received: (qmail 73856 invoked by uid 500); 25 Apr 2007 10:40:32 -0000 Mailing-List: contact axis-cvs-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-cvs@ws.apache.org Received: (qmail 73845 invoked by uid 500); 25 Apr 2007 10:40:32 -0000 Delivered-To: apmail-ws-axis2-cvs@ws.apache.org Received: (qmail 73838 invoked by uid 99); 25 Apr 2007 10:40:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2007 03:40:31 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Apr 2007 03:40:20 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 5E3671A984A; Wed, 25 Apr 2007 03:40:00 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r532305 [4/4] - in /webservices/axis2/scratch/c/neethi/axis2c: ./ axiom/ axiom/src/soap/ guththila/ ides/ ides/anjuta/ ides/vc/axis2c/axis2_engine/ ides/vc/axis2c/axis2_http_receiver/ ides/vc/axis2c/axis2_http_sender/ ides/vc/axis2c/axis2_h... Date: Wed, 25 Apr 2007 10:39:58 -0000 To: axis2-cvs@ws.apache.org From: manjula@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070425104000.5E3671A984A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/installationguide.html URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/installationguide.html?view=diff&rev=532305&r1=532304&r2=532305 ============================================================================== --- webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/installationguide.html (original) +++ webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/installationguide.html Wed Apr 25 03:39:55 2007 @@ -6,74 +6,73 @@ Apache Axis2/C Installation Guide -

Apache Axis2/C Installation Guide

-

This document will guide you on how to install Axis2/C and run the server -and client samples on Linux and Microsoft Windows operating systems.

+

This document guides you on how to install Axis2/C, and run the server and +client samples on Linux and Microsoft Windows operating systems.

-

This release comes in two forms, source and binary. This document covers both those forms.

+

This release comes in two forms, source and binary. This document covers +both forms.

Please send your feedback to the developer mailing list: axis-c-dev@ws.apache.org (please -remember to prefix the subject with [Axis2]). To subscribe to developer -mailing list see here.

+href="mailto:axis-c-dev@ws.apache.org">axis-c-dev@ws.apache.org +(Subscription details are available on the Axis2 site.) Please +remember to prefix the subject with [Axis2].

Contents

-

1. Installing and Running on Linux

-

This can be done using binary or source distributions.(You can download the two distributions here)

+

This can be done using binary or source distributions. (Download the two +distributions)

-

To get both the binary and source distributions working, you need -Libxml2.

- -

Note : Most Linux systems have Libxml2 installed by default. On MS -Windows you need to download and install Libxml2.

+

To get both the binary and source distributions working, you need Libxml2.

+

Note: Most Linux systems have Libxml2 installed by default. On MS +Windows, you need to download and install Libxml2.

-

1.1. Installing Binary Distribution

+

1.1. Installing the Binary Distribution

-

The following steps need to be followed to install and run -Axis2/C binary distribution on Linux : -

+

The following steps have to be followed to install and run the Axis2/C +binary distribution on Linux :

    -
  1. Extract the binary tar package to a folder
  2. -
  3. Set AXIS2C_HOME environment variable pointing to the location where you - have extracted Axis2/C +
  4. Extract the binary tar package to a folder.
  5. +
  6. Set the AXIS2C_HOME environment variable pointing to the location where + you have extracted Axis2/C
    • AXIS2C_HOME='/your_path_to_axis2c'
    • export AXIS2C_HOME
    • -

      Note : You will need to set AXIS2C_HOME only if you - need to run Axis2/C samples. The reason is that the samples - use AXIS2C_HOME to get the path to Axis2/C repository. To write your own - services or clients this is not a requirement.

      +

      Note: You will need to set the AXIS2C_HOME only if + you need to run the Axis2/C samples. The reason is that the samples use + AXIS2C_HOME to get the path to the Axis2/C repository. This is not + required to write your own services or clients.

  7. Run the simple axis server:
      -
    • To start the simple axis server on default port 9090, run the +
    • To start the simple axis server on the default port 9090, run the following commands.
      • cd /your_path_to_axis2c/bin
      • @@ -81,8 +80,9 @@
    • To see the possible command line options run ./axis2_http_server -h -

      Note : If you run into shared library problems, try - setting the LD_LIBRARY_PATH to include the lib folder containing the Axis2/C libs.

      +

      Note: If you run into shared library problems, + try setting the LD_LIBRARY_PATH to include the lib folder containing + the Axis2/C libs.

      • LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your_path_to_axis2c/lib
      • export LD_LIBRARY_PATH
      • @@ -93,54 +93,54 @@
      • Run the sample clients in a new shell
        • cd /your_path_to_axis2c/bin/samples
        • -
        • To run client for echo service +
        • To run the client for echo service
          • ./echo
        • -
        • To run client for math service +
        • To run the client for math service
          • ./math
        • -
        • To see the possible command line options for sample clients run - them with '-h' option
        • -

          Note : If you run into shared library problems, try +

        • To see the possible command line options for the sample clients, + run them with the '-h' option
        • +

          Note: If you run into shared library problems, try setting the LD_LIBRARY_PATH

            -
          • LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your_path_to_axis2c/lib
          • -
          • export LD_LIBRARY_PATH
          • +
          • LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your_path_to_axis2c/lib
          • +
          • export LD_LIBRARY_PATH
- -

1.2. Installing Source Distribution

-

The following steps need to be followed to install and run Axis2/C using -source distribution on Linux : -

+

1.2. Installing the Source Distribution

+ +

The following steps have to be followed to install and run Axis2/C using +the source distribution on Linux :

    -
  1. Extract the source tar package to a folder
  2. -
  3. Set AXIS2C_HOME environment variable pointing to the location where you - want to install Axis2/C +
  4. Extract the source tar package to a folder.
  5. +
  6. Set the AXIS2C_HOME environment variable pointing to the location where + you want to install Axis2/C
    • AXIS2C_HOME='/your_desired_path_to_axis2c_installation'
    • export AXIS2C_HOME
    • -

      Note : You will need to set AXIS2C_HOME only if you - need to run Axis2/C samples. The reason is that the samples - use AXIS2C_HOME to get the path to Axis2/C repository. To write your own - services or clients this is not a requirement.

      +

      Note: You will have to set AXIS2C_HOME only if you + want to run the Axis2/C samples. The reason is that the samples use + AXIS2C_HOME to get the path to the Axis2/C repository. This is not + required to write your own services or clients.

  7. -
  8. Then go to the folder where you extracted the source +
  9. Then go to the folder where you extracted the source.
    • cd /your_path_to_axis2c_source
  10. Build the source
      -
    • This can be done using the following command sequence in the +
    • This can be done using the following command sequence, in the directory where you have extracted the source:
      • ./configure
      • @@ -149,11 +149,11 @@
    • Use './configure --help' for possible command line options.
    • -
    • Note :If you do not provide a --prefix configure - option, the default installation would be /usr/local/axis2c +
    • Note: If you do not provide a --prefix configure + option, the default installation would be in the /usr/local/axis2c directory.
    • -
    • You may need to try Axis2/C with Guththila XML parser. You can do - that by providing --enable-guththila=yes option when configuring +
    • You may have to try Axis2/C with Guththila XML parser. You can do + that by providing the --enable-guththila=yes option when configuring.
      • ./configure --enable-guththila=yes [other configuration options]
      • @@ -161,7 +161,7 @@
      • make install
    • -
    • If you need to get the samples working, you also need to build the +
    • If you want to get the samples working, you have to build the samples.
      To build the samples:
        @@ -175,75 +175,77 @@
      • make install
    • -
    • Please run "./configure --help" in samples folder for more - information on configure options.
    • -
    • Note : If you do not provide a --prefix configure - option, samples will by default be installed into +
    • Please run "./configure --help" in the samples folder for more + information on the configure options.
    • +
    • Note: If you do not provide a --prefix configure + option, by default, the samples will be installed into the "/usr/local/axis2c/bin/samples" directory.
  11. Go to where you installed Axis2/C.
  12. -
  13. Start simple axis server +
  14. Start the simple axis server.
      -
    • To start the simple axis server on port 9090 run the following - command lines +
    • To start the simple axis server on port 9090, run the following + command lines.
      • cd /path_you_installed_axis2c/bin
      • ./axis2_http_server
    • -
    • To see the possible command line options run ./axis2_http_server -h
    • -
    • Note : You may need to be logged in as a superuser to - run the simple axis server, if you installed Axis2/C as super user.
    • +
    • To see the possible command line options, run ./axis2_http_server + -h
    • +
    • Note: You may have to be logged in as a superuser + to run the simple axis server if you installed Axis2/C as a super + user.
  15. -
  16. Run the sample clients in a new shell using the following command lines +
  17. Run the sample clients in a new shell using the following command lines.
    • cd /path_you_installed_axis2c/bin/samples
    • -
    • to run client for echo service +
    • To run the client for the echo service
      • ./echo
    • -
    • to run client for math service +
    • To run the client for the math service
      • ./math
    • -
    • To see the possible command line options for sample clients run - them with '-h' option
    • +
    • To see the possible command line options for the sample clients, + run them with the '-h' option
-

2. Installing and Running on Microsoft Windows

-

This too can be done using either binary or source distributions. -(You can download the two distributions here)

- -

For both the binary and source distributions, you need to -download Libxml2.

+

This too can be done using binary or source distributions. (Download the two +distributions.)

+

For both binary and source distributions, you have to download Libxml2.

-

2. 1. Installing Binary Distribution

- +

2. 1. Installing the Binary Distribution

2.1.1. Requirements

    -
  • The binaries shipped with this version are compiled with Microsoft +
  • The binaries shipped with this version are compiled with the Microsoft Visual Studio compiler (cl)
  • -

    (Note: you can download Microsoft VSExpress2005 edition - from the Microsoft Web site and install it to run these binaries)

    +

    (Note: you can download the + Microsoft VSExpress2005 edition from the Microsoft Web site and install + it to run these binaries.)

  • You also need the following DLLs:
    • libxml2.dll [http://www.xmlsoft.org - download the version >= - libxml2-2.6.27.win32]
    • -
    • iconv.dll [http://www.gnu.org/software/libiconv/ - download the version >= - iconv-1.9.1.win32]
    • + libxml2-2.6.27.win32] +
    • iconv.dll [http://www.gnu.org/software/libiconv/ - download the + version >= iconv-1.9.1.win32]
    • zlib1.dll [http://www.gzip.org/zlib/ - download the version >= zlib-1.2.3.win32]
    @@ -251,7 +253,7 @@
-

2.1.2. Binaries in The Release

+

2.1.2. Binaries in the Release

  • Extract the binary distribution to a folder of your choice. (example: C:\axis2c)
  • @@ -262,38 +264,39 @@

    The above folders contain the following files:

      -
    • bin - server and other executable
    • -
    • bin\samples - client samples go here
    • +
    • bin - server and other executables
    • +
    • bin\samples - client samples
    • lib - library modules
    • services - deployed services
    • modules - deployed modules
    • -
    • include - all include files of Axis2/C
    • +
    • include - all Include files of Axis2/C
    • logs - system and client logs are written to this folder
    -
  • Copy libxml2.dll, iconv.dll and zlib1.dll downloaded to +
  • Copy libxml2.dll, iconv.dll, and zlib1.dll downloaded to C:\axis2c\lib
-

2.1.3. Running The Binaries

+

2.1.3. Running the Binaries

  • First, you need to set a couple of environment variables before you can run the server and samples.
    • Set the variable AXIS2C_HOME to the deploy folder (C:\axis2c)
    • -
    • Add the path to lib directory to the PATH variable - (%AXIS2C_HOME%\lib)
    • +
    • Add the path to the lib directory to the PATH variable + (%AXIS2C_HOME%\lib)
  • -
  • Now everything is set to run the server

    - C:\axis2c\bin\>axis2_http_server.exe

  • -
  • If the server is running successfully you should see the message +
  • Now everything is set to run the server. +

    C:\axis2c\bin\>axis2_http_server.exe

    +
  • +
  • If the server is running successfully, you will see the message "Started Simple Axis2 HTTP Server..."
  • -
  • The log is by default created in %AXIS2C_HOME%\logs folder with the - name axis2.log.
  • -
  • (Note: You may provide command line options to change the default - behavior. Use the command "axis2_http_server.exe -h" to learn about the - usage)
  • +
  • By default, the log is created in the %AXIS2C_HOME%\logs folder with + the name axis2.log.
  • +
  • (Note: You can provide command line options to change + the default behavior. Use the command "axis2_http_server.exe -h" to learn + about the usage)
  • Now you can run any sample client located in %AXIS2C_HOME%\bin\samples\
    • Example: C:\axis2c\bin\samples\> echo.exe
    • @@ -303,22 +306,23 @@

      2. 2. Installing Source Distribution

      -

      2.2.1. Requirements

      • The makefile shipped with this version needs Microsoft Visual Studio - Compiler (cl) and nmake build tool.
      • + Compiler (cl) and the NMake build tool. -

        (Note: You can download Microsoft VSExpress2005 edition and Platform SDK - from Microsoft Web site. You will need to add the path to Platform SDK - Include and Lib folders to makefile)

        +

        (Note: You can download the + Microsoft VSExpress2005 edition and Platform SDK from the Microsoft Web + site. You will need to add the path to the Platform SDK Include and Lib + folders to the makefile)

      • You also need
        • Libxml2 [http://www.xmlsoft.org - download the version >= libxml2-2.6.27.win32]
        • -
        • iconv [http://www.gnu.org/software/libiconv/ - download the version >= - iconv-1.9.1.win32]
        • +
        • iconv [http://www.gnu.org/software/libiconv/ - download the version + >= iconv-1.9.1.win32]
        • zlib [http://www.gzip.org/zlib/ - download the version >= zlib-1.2.3.win32]
        @@ -326,52 +330,56 @@
      -

      2.2.3. Editing configure.in File

      -

      Please edit <source_distribution>\build\win32\configure.in file to include following information.

      +

      2.2.3. Editing the configure.in File

      + +

      Please edit the <source_distribution>\build\win32\configure.in file +to include the following information.

      • The default paths for Libxml2 and iconv are specified in configure.in
          -
        • Example:If libxml2 is installed into C:\libxml2, edit configure.in file accordingly.
        • +
        • Example:If libxml2 is installed into C:\libxml2, edit the + configure.in file accordingly.
      • -
      • You can either extract Libxml2 to this folder, in which case folder +
      • You can either extract Libxml2 to this folder, in which case the folder structure for C:\libxml2 should look like the following:
      • Figure: C:\libxml2 Folder Structure

        -

        Or extract to a location of your choice and edit the configure.in - accordingly.

        +

        Else, extract it to a location of your choice and edit the configure.in + file accordingly.

      • You need to have zlib1.dll in a library path. You may copy this DLL to libxml2/lib.
      • -
      • If you need the parser to use Guththila XML parser, ENABLE_GUTHTHILA option should be set to 1 in configure.in +
      • If you need the parser to use Guththila XML parser, the + ENABLE_GUTHTHILA option should be set to 1 in configure.in
          -
        • Example: ENABLE_GUTHTHILA = 1
        • +
        • Example: ENABLE_GUTHTHILA = 1
      - -

      2.2.4. Compiling The Source

      +

      2.2.4. Compiling the Source

      -

      The following steps will take you through the source compilation

      +

      The following steps will take you through the source compilation.

      • Extract the source distribution to a folder of your choice. (Example: C:\axis2c)
      • -
      • Edit configure.in file as explained in the section 2.2.3
      • +
      • Edit the configure.in file as explained in the section 2.2.3
      • Open a DOS shell
      • cd C:\axis2c\build\win32
      • to access .Net tools, run
        • C:\axis2c\build\win32> vcvars32.bat
        -

        (Note: You may need to set the PATH environment variable to - vcvars32.bat if Windows complaints that it cannot find this batch file. This file is located in - <your MS Visual Studio install Directory>\VC\bin directory.)

        +

        (Note: You may have to set the PATH environment + variable to vcvars32.bat if MS Windows gives an error indicating that it + cannot find this batch file. This file is located in <your MS Visual + Studio install Directory>\VC\bin directory.)

      • -
      • To build the system and create the binary files in a directory named deploy under build - directory: +
      • To build the system and create the binary files in a directory named + deploy under the build directory,
        • C:\axis2c\build\win32>nmake install
        @@ -394,28 +402,28 @@
      -

      2.2.5. Running The Binaries

      +

      2.2.5. Running the Binaries

        -
      • You need to set couple of environment variables before you can run the - server and samples. +
      • You need to set a couple of environment variables before you can run + the server and samples.
        • Set the variable AXIS2C_HOME to the deploy folder (C:\axis2c\build\deploy)
        • -
        • Add the path to lib directory to PATH variable - (%AXIS2C_HOME%\lib)
        • +
        • Add the path to the lib directory to the PATH variable + (%AXIS2C_HOME%\lib)
        • Copy libxml2.dll, iconv.dll and zlib1.dll to Axis2/C lib folder (%AXIS2C_HOME%\lib)
      • Now run the server - C:\axis2c\build\deploy\bin> axis2_http_server.exe
      • -
      • If server is running successfully you should see the message "Started - Simple Axis2 HTTP Server..."
      • -
      • The log is by default created under %AXIS2C_HOME%\logs folder with the - name axis2.log.
      • -
      • (Note: you may provide command line options to change the default - behavior. Use the command "axis2_http_server.exe -h" to learn about the - usage)
      • +
      • If the server is running successfully, you will see the message + "Started Simple Axis2 HTTP Server..."
      • +
      • By default, the log is created under the %AXIS2C_HOME%\logs folder with + the name axis2.log.
      • +
      • (Note: You can provide command line options to change + the default behavior. Use the command "axis2_http_server.exe -h" to learn + about the usage)
      • Now you can run any sample client deployed under %AXIS2C_HOME%\bin\samples\
          Modified: webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/om_tutorial.html URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/om_tutorial.html?view=diff&rev=532305&r1=532304&r2=532305 ============================================================================== --- webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/om_tutorial.html (original) +++ webservices/axis2/scratch/c/neethi/axis2c/xdocs/docs/om_tutorial.html Wed Apr 25 03:39:55 2007 @@ -3,10 +3,9 @@ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> - + Apache Axis2/C AXOM Tutorial - @@ -16,13 +15,13 @@ @@ -42,79 +43,78 @@

          Introduction

          -

          What is AXIOM?

          -

          AXIOM stands for AXis Object Model and refers to -the XML infoset model that is developed for Axis2. XML infoset refers to the -information included inside the XML. For programmatical manipulation it is -convenient to have a representation of this XML infoset in a language -specific manner. DOM and JDOM are two such XML models. AXIOM is conceptually -similar to such an XML model by its external behavior but deep down it is -very much different.

          +

          AXIOM stands for AXis Object Model and refers to the XML infoset model +that is developed for Apache Axis2. XML infoset refers to the information +included inside the XML. For programmatical manipulation, it is convenient to +have a representation of this XML infoset in a language specific manner. DOM +and JDOM are two such XML models. AXIOM is conceptually similar to such an +XML model in its external behavior but deep down it is very different.

          The objective of this tutorial is to introduce the basics of AXIOM/C and -explain best practices while using AXIOM.

          +explain the best practices while using AXIOM.

          -

          AXIOM/C is a C equivalant of AXIOM/Java. We have done our best to get almost -the same kind of API in C.

          +

          AXIOM/C is a C equivalant of AXIOM/Java. We have done our best to get +almost the same kind of API in C.

          -

          For whom is this Tutorial?

          +

          For whom is this tutorial?

          This tutorial can be used by anybody who is interested and wants to go deeper in to AXIOM/C. Knowledge in similar object models such as DOM will be -quite helpful in understanding AXIOM but such knowledge is not assumed. Several -links are listed in the links section that will help understand the -basics of XML.

          +helpful in understanding AXIOM, but such knowledge has not been assumed. +Several links are listed in the links section that will help you understand +the basics of XML.

          What is Pull Parsing ?

          Pull parsing is a new trend in XML processing. The previously popular XML processing frameworks such as DOM were "push-based", which means that the control of parsing was with the parser itself. This approach is fine and easy -to use but it is not efficient in handling large XML documents since a +to use, but it is not efficient in handling large XML documents since a complete memory model will be generated in the memory. Pull parsing inverts -the control and hence the parser only proceeds at the user's command. The user -can decide to store or discard events generated from the parser. AXIOM is based -on pull parsing. To learn more about XML pull parsing see the XML pull -parsing introduction. +parsing introduction. -

          Features of AXIOM

          AXIOM is a lightweight, differed built XML infoset representation based on -StAX API derived form (JSR -173), which is the standard streaming pull parser API. AXIOM can be -manipulated as flexibly as any other object model (such as JDOM), but underneath the objects will be +173, which is the standard streaming pull parser API. AXIOM can be +manipulated as flexibly as any other object model such as JDOM, but underneath, the objects will be created only when they are absolutely required. This leads to much less -memory intensive programming.

          +memory-intensive programming.

          -

          Following is a short feature overview of AXIOM.

          +

          The following is a short feature overview of AXIOM.

          • Lightweight: AXIOM is specifically targeted to be lightweight. This is - achieved by reducing the depth of the hierarchy, the number of methods + achieved by reducing the depth of the hierarchy, the number of methods, and the attributes enclosed in the objects. This makes the objects less memory intensive.
          • -
          • Differed building: By far this is the most important feature of AXIOM. The - objects are not made unless a need arises for them. This passes the - control of building to the object model itself rather than an external +
          • Differed building: By far, this is the most important feature of AXIOM. + The objects are not made unless a need arises for them. This passes the + control of building to the object model itself, rather than an external builder.
          • -
          • Pull based: For a differed building mechanism a pull based parser is - required. AXIOM is based on StAX, the standard pull parser API. +
          • Pull based: For a differed building mechanism, a pull-based parser is + required. AXIOM is based on StAX, which is the standard pull parser API.

            Since different XML parsers offer different kinds of pull parser APIs, we define an API derived from StAX. That API is defined in - axiom_xml_reader.h. Similarly we define an XML writer API in - axiom_xml_writer.h. These two APIs work as an abstarction + axiom_xml_reader.h. Similarly, we define an XML writer API + in axiom_xml_writer.h. These two APIs work as an abstarction layer between any XML parser and AXIOM. So any parser that is going to be used for AXIOM should implement the axiom_xml_reader API and - axiom_xml_writer API using a wrapper layer.

            + the axiom_xml_writer API using a wrapper layer.

            -

            Currenly we use Libxml2 as our default XML parser.

            +

            Currenly we use Libxml2 as our default XML + parser.

          @@ -122,20 +122,19 @@

          -

          AXIOM Builder wraps the raw XML character stream through the +

          The AXIOM Builder wraps the raw XML character stream through the axiom_xml_reader API. Hence the complexities of the pull event -stream are hidden form the user.

          - +stream are hidden from the user.

          +

          Where does SOAP come into play?

          -

          In a nutshell SOAP is an information exchange protocol based on XML. SOAP -has a defined set of XML elements that should be used in messages. Since Axis2 -is a "SOAP Engine" and AXIOM is designed for Axis2, a SOAP specific API was -implemented on top of AXIOM. We have defined a number of structs to represent -SOAP constructs, which wraps general AXIOM structures. See here to learn more -about SOAP.

          +

          In a nutshell, SOAP is an information exchange protocol based on XML. SOAP +has a defined set of XML elements that should be used in messages. Since +Axis2 is a "SOAP Engine" and AXIOM is designed for Axis2, a SOAP specific API +was implemented on top of AXIOM. We have defined a number of structs to +represent SOAP constructs, which wrap general AXIOM structures. Learn more +about SOAP.

          - +

          Serialization

          -

          AXIOM can be serialized using axiom_node_serialize function.The -serialization uses axiom_xml_writer.h and +

          AXIOM can be serialized using the axiom_node_serialize +function. The serialization uses axiom_xml_writer.h and axiom_output.h APIs.

          -

          Here is an example that shows how to write the output to the console (we have -serialized the SOAP envelope created in code listing 1).

          +

          Here is an example that shows how to write the output to the console (we +have serialized the SOAP envelope created in code listing 1).

          Code Listing 8

          axiom_xml_writer_t *xml_writer = NULL;
          @@ -567,20 +559,20 @@
           printf("%s", xml_output);
           AXIS2_FREE(env->allocator, xml_output);
          -

          Note that freeing the returned buffer is user's responsibility.

          - +

          Note that freeing the returned buffer is the user's responsibility.

          +

          Using axiom_xml_reader and axiom_xml_writer

          -

          axiom_xml_reader provides three create functions that can -be used for different xml input sources.

          +

          axiom_xml_reader provides three create functions that can be +used for different XML input sources.

            -
          • axiom_xml_reader_create_for_file function can be used to - read from a file
          • +
          • axiom_xml_reader_create_for_file can be used to read from + a file
          • axiom_xml_reader_create_for_io uses a user defined - callback function to pull xml
          • + callback function to pull XML
          • axiom_xml_reader_create_for_memory can be used to read - from an xml string that is in a character buffer
          • + from an XML string that is in a character buffer

          Similarly axiom_xml_writer provides two create functions.

          @@ -588,8 +580,8 @@
        • axiom_xml_writer_create_for_file can be used to write to a file
        • axiom_xml_writer_create_for_memory can be used to write to - an internal memory buffer and obtain the XML string as a character buffer -
        • + an internal memory buffer and obtain the XML string as a character + buffer

        @@ -598,25 +590,28 @@ axiom_xml_writer.h for more information.

        - -

        How to Avoid Memory Leaks and Double Frees When Using AXIOM

        - -

        You have to be extremely careful when using AXIOM, in order to avoid memory -leaks and double free errors. The following guidelines will be extremely useful:

        -

        1. axiom_element struct keeps a list of attributes and a list -of namespaces, when an axiom_namespace pointer or an axiom_attribute pointer -is added to these lists, that will be -freed when the axiom_element is freed. Therefore a pointer to a namespace or -an attribute should not be freed, once that is used with an axiom_element.

        +

        How to Avoid Memory Leaks and Double Frees When Using AXIOM

        -

        To avoid the inconvenience, clone functions have been implemented for both -axiom_namespace and axiom_attribute structures.

        +

        You have to be extremely careful when using AXIOM, in order to avoid +memory leaks and double free errors. The following guidelines will be +extremely useful:

        + +

        1. The axiom_element struct keeps a list of attributes and a +list of namespaces, when an axiom_namespace pointer or an +axiom_attribute pointer is added to these lists, which will be +freed when the axiom_element is freed. Therefore a pointer to a +namespace or an attribute should not be freed, once it is used with an +axiom_element.

        + +

        To avoid any inconvenience, clone functions have been implemented for both +the axiom_namespace and axiom_attribute +structures.

        2. AXIOM returns shallow references to its string values. Therefore, when -you want deep copies of returned values, axutil_strdup() function should be used to avoid -double free errors.

        +you want deep copies of returned values, the axutil_strdup() +function should be used to avoid double free errors.

        Example

        @@ -629,151 +624,158 @@

        uri = axiom_namespace_get_uri(ns, env);

        -

        /* now uri points to the same place where namespace struct's uri
        -pointer is pointing. Therefore following will cause a double free */

        +

        /* now uri points to the same place where namespace struct's uri
        +pointer is pointing. Therefore following will cause a double free +*/

        AXIS2_FREE(env->allocator, uri);

        axiom_namespace_free(ns, env);

        -

        3. When creating AXIOM programatically , if you are declaring a namespace with -an axiom_element, it is advisable to find whether the namespace is already -available in the elements scope using axiom_element_find_namespace function. If available, -that pointer can be used instead of creating another namespace struct -instance to minimize memory usage.

        +

        3. When creating AXIOM programatically, if you are declaring a namespace +with an axiom_element, it is advisable to find whether the +namespace is already available in the elements scope using the +axiom_element_find_namespace function. If available, that +pointer can be used instead of creating another namespace struct instance to +minimize memory usage.

        +

        +

        Complete Code for the AXIOM Based Document Building and Serialization

        -

        The following code segment shows how to use the AXIOM for completely building -a document and then serializing it into text pushing the output to the + +

        The following code segment shows how to use AXIOM for building a document +completely and then serializing it into text, pushing the output to the console.

        +

        -

        Code Listing 10

        -
        #include <axiom.h>
        -#include <axis2_util.h>
        -#include <axutil_env.h>
        -#include <axuitl_log_default.h>
        -#include <axutil_error_default.h>
        -#include <stdio.h>
        +

        Code Listing 10

        +
        #include <axiom.h>
        +#include <axis2_util.h>
        +#include <axutil_env.h>
        +#include <axuitl_log_default.h>
        +#include <axutil_error_default.h>
        +#include <stdio.h>
         
        -FILE *f = NULL;
        -int read_input_callback(char *buffer, int size, void* ctx)
        +FILE *f = NULL;
        +int read_input_callback(char *buffer, int size, void* ctx)
         {
        -    return fread(buffer, sizeof(char), size, f);
        +    return fread(buffer, sizeof(char), size, f);
         }
        -int close_input_callback(void *ctx)
        +int close_input_callback(void *ctx)
         {
        -    return fclose(f);
        +    return fclose(f);
         }
        -axutil_env_t * create_environment()
        +axutil_env_t * create_environment()
         {
        -    axutil_allocator_t *allocator = NULL;
        -    axutil_env_t *env = NULL;
        -    axuitl_log_t *log = NULL;
        -
        -    axutil_error_t *error = NULL;
        -    allocator = axutil_allocator_init(NULL);
        -    log = axuitl_log_create(allocator, NULL, NULL);
        -
        -    error = axutil_error_create(allocator);
        -    env = axutil_env_create_with_error_log(allocator, error, log);
        -    return env;
        +    axutil_allocator_t *allocator = NULL;
        +    axutil_env_t *env = NULL;
        +    axuitl_log_t *log = NULL;
        +
        +    axutil_error_t *error = NULL;
        +    allocator = axutil_allocator_init(NULL);
        +    log = axuitl_log_create(allocator, NULL, NULL);
        +
        +    error = axutil_error_create(allocator);
        +    env = axutil_env_create_with_error_log(allocator, error, log);
        +    return env;
         }
         
        -build_and_serialize_om(axutil_env_t *env)
        +build_and_serialize_om(axutil_env_t *env)
         {
        -    axiom_node_t *root_node = NULL;
        +    axiom_node_t *root_node = NULL;
         
        -    axiom_element_t *root_ele = NULL;
        -    axiom_document_t *document = NULL;
        -    axiom_stax_builder_t *om_builder = NULL;
        -
        -    axiom_xml_reader_t *xml_reader = NULL;
        -    axiom_xml_writer_t *xml_writer = NULL;
        -    axiom_output_t *om_output = NULL;
        -
        -    axis2_char_t *buffer = NULL;
        -    
        -    f = fopen("test.xml","r");
        -    xml_reader = axiom_xml_reader_create_for_io(env, read_input_callback,
        -                                                    close_input_callback, NULL, NULL);
        -    if(!xml_reader)
        -        return -1;
        -
        -    om_builder = axiom_stax_builder_create(env, xml_reader);
        -    if(!om_builder)
        -    {
        -        AXIOM_XML_READER_FREE(xml_reader, env);
        -        return AXIS2_FAILURE;
        -    }
        -    document = AXIOM_STAX_BUILDER_GET_DOCUMENT(om_builder, env);
        -    if(!document)
        -    {
        -        AXIOM_STAX_BUILDER_FREE(om_builder, env);
        -        return AXIS2_FAILURE;
        -    }
        -    
        -    root_node = AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, env);
        -    if(!root_node)
        -    {
        -        AXIOM_STAX_BUILDER_FREE(om_builder, env);
        -        return AXIS2_FAILURE;
        -    }        
        -    if(root_node)
        -    {
        -        if(AXIOM_NODE_GET_NODE_TYPE(root_node, env) == AXIOM_ELEMENT)
        -        {
        -            root_ele = (axiom_element_t*)AXIOM_NODE_GET_DATA_ELEMENT (root_node, env);
        -            if(root_ele)
        -            {
        -                printf(" %s" , AXIOM_ELEMENT_GET_LOCALNAME(root_ele, env));
        -            }
        -        }
        -    }
        -    AXIOM_DOCUMENT_BUILD_ALL(document, env);
        -    
        -    xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0, AXIS2_XML_PARSER_TYPE_BUFFER);
        -    
        -    om_output = axiom_output_create(env, xml_writer);
        -    
        -    AXIOM_NODE_SERIALIZE(root_node, env, om_output);
        -    buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(xml_writer, env);
        -
        -    printf("The output XML is ->>>>\n %s ", buffer);
        -
        -    
        -    /** when om_output is freed xml_writer is also freed */
        -    
        -    AXIOM_OUTPUT_FREE(om_output, env);
        -    
        -    /** when om_builder is freed , the builder, om_document and the entire AXIOM structure is freed */
        -    AXIOM_STAX_BUILDER_FREE(om_builder, env);
        -    
        -    AXIS2_FREE(env->allocator, buffer);
        -    
        -    return AXIS2_SUCCESS;
        -    
        +    axiom_element_t *root_ele = NULL;
        +    axiom_document_t *document = NULL;
        +    axiom_stax_builder_t *om_builder = NULL;
        +
        +    axiom_xml_reader_t *xml_reader = NULL;
        +    axiom_xml_writer_t *xml_writer = NULL;
        +    axiom_output_t *om_output = NULL;
        +
        +    axis2_char_t *buffer = NULL;
        +    
        +    f = fopen("test.xml","r");
        +    xml_reader = axiom_xml_reader_create_for_io(env, read_input_callback,
        +                                                    close_input_callback, NULL, NULL);
        +    if(!xml_reader)
        +        return -1;
        +
        +    om_builder = axiom_stax_builder_create(env, xml_reader);
        +    if(!om_builder)
        +    {
        +        AXIOM_XML_READER_FREE(xml_reader, env);
        +        return AXIS2_FAILURE;
        +    }
        +    document = AXIOM_STAX_BUILDER_GET_DOCUMENT(om_builder, env);
        +    if(!document)
        +    {
        +        AXIOM_STAX_BUILDER_FREE(om_builder, env);
        +        return AXIS2_FAILURE;
        +    }
        +    
        +    root_node = AXIOM_DOCUMENT_GET_ROOT_ELEMENT(document, env);
        +    if(!root_node)
        +    {
        +        AXIOM_STAX_BUILDER_FREE(om_builder, env);
        +        return AXIS2_FAILURE;
        +    }        
        +    if(root_node)
        +    {
        +        if(AXIOM_NODE_GET_NODE_TYPE(root_node, env) == AXIOM_ELEMENT)
        +        {
        +            root_ele = (axiom_element_t*)AXIOM_NODE_GET_DATA_ELEMENT (root_node, env);
        +            if(root_ele)
        +            {
        +                printf(" %s" , AXIOM_ELEMENT_GET_LOCALNAME(root_ele, env));
        +            }
        +        }
        +    }
        +    AXIOM_DOCUMENT_BUILD_ALL(document, env);
        +    
        +    xml_writer = axiom_xml_writer_create_for_memory(env, NULL, AXIS2_TRUE, 0, AXIS2_XML_PARSER_TYPE_BUFFER);
        +    
        +    om_output = axiom_output_create(env, xml_writer);
        +    
        +    AXIOM_NODE_SERIALIZE(root_node, env, om_output);
        +    buffer = (axis2_char_t*)AXIOM_XML_WRITER_GET_XML(xml_writer, env);
        +
        +    printf("The output XML is ->>>>\n %s ", buffer);
        +
        +    
        +    /** when om_output is freed xml_writer is also freed */
        +    
        +    AXIOM_OUTPUT_FREE(om_output, env);
        +    
        +    /** when om_builder is freed , the builder, om_document and the entire AXIOM structure is freed */
        +    AXIOM_STAX_BUILDER_FREE(om_builder, env);
        +    
        +    AXIS2_FREE(env->allocator, buffer);
        +    
        +    return AXIS2_SUCCESS;
        +    
         }
        -int main()
        +int main()
         {
        -    int status = AXIS2_SUCCESS;
        -    
        -    axutil_env_t *env = NULL;
        -    axutil_allocator_t *allocator = NULL;
        -    env = create_environment();
        -
        -    status = build_and_serialize_om(env); -
        -    if(status == AXIS2_FAILURE) -    { -        printf(" build AXIOM failed"); -    } -     -    axutil_env_free(env); -     -    return 0; +    int status = AXIS2_SUCCESS; +     +    axutil_env_t *env = NULL; +    axutil_allocator_t *allocator = NULL; +    env = create_environment(); +
        +    status = build_and_serialize_om(env); +
        +    if(status == AXIS2_FAILURE) +    { +        printf(" build AXIOM failed"); +    } +     +    axutil_env_free(env); +     +    return 0; }
        Modified: webservices/axis2/scratch/c/neethi/axis2c/xdocs/navigation.xml URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/c/neethi/axis2c/xdocs/navigation.xml?view=diff&rev=532305&r1=532304&r2=532305 ============================================================================== --- webservices/axis2/scratch/c/neethi/axis2c/xdocs/navigation.xml (original) +++ webservices/axis2/scratch/c/neethi/axis2c/xdocs/navigation.xml Wed Apr 25 03:39:55 2007 @@ -6,20 +6,23 @@ - - - - + + + + + + + - + --------------------------------------------------------------------- To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org For additional commands, e-mail: axis-cvs-help@ws.apache.org