alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Axis 2 example source code file (StubHeaderTemplate.xsl)

This example Axis 2 source code file (StubHeaderTemplate.xsl) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Axis 2 tags/keywords

async, async, axis2_call, axis2_call

The Axis 2 StubHeaderTemplate.xsl source code

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="text"/>

    <xsl:template match="/class">
        <xsl:variable name="interfaceName">
        <xsl:variable name="callbackname">
        <xsl:variable name="isSync">
        <xsl:variable name="isAsync">
        <xsl:variable name="soapVersion">
        <xsl:variable name="method-prefix">
        <xsl:variable name="qname">

        /**
        * <xsl:value-of select="@name"/>.h
        *
        * This file was auto-generated from WSDL for "<xsl:value-of select="$qname"/>" service
        * by the Apache Axis2/C version: #axisVersion# #today#
        */

        #include <stdio.h>
        #include <axiom.h>
        #include <axutil_utils.h>
        #include <axiom_soap.h>
        #include <axis2_client.h>
        #include <axis2_stub.h>

       <xsl:for-each select="method">
        <xsl:if test="output/param[@ours and @type!='']">
         <xsl:variable name="outputtype">adb_
         #include "<xsl:value-of select="$outputtype"/>.h"
        </xsl:if>
        <xsl:for-each select="input/param[@type!='' and @ours ]">
         <xsl:variable name="inputtype">adb_
         #include "<xsl:value-of select="$inputtype"/>.h"
        </xsl:for-each>
       </xsl:for-each>
        /* function prototypes - for header file*/
        /**
         * <xsl:value-of select="$method-prefix"/>_create
         * create and return the stub with services populated
         * params - env : environment ( mandatory)
         *        - client_home : Axis2/C home ( mandatory )
         *        - endpoint_uri : service endpoint uri( optional ) - if NULL default picked from wsdl used
         */
        axis2_stub_t*
        <xsl:value-of select="$method-prefix"/>_create (const axutil_env_t *env,
                                        axis2_char_t *client_home,
                                        axis2_char_t *endpoint_uri);
        /**
         * <xsl:value-of select="$method-prefix"/>_populate_services
         * populate the svc in stub with the service and operations
         */
        void <xsl:value-of select="$method-prefix"/>_populate_services( axis2_stub_t *stub, const axutil_env_t *env);
        /**
         * <xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl
         * return the endpoint URI picked from wsdl
         */
        axis2_char_t *<xsl:value-of select="$method-prefix"/>_get_endpoint_uri_from_wsdl ( const axutil_env_t *env );

        <xsl:if test="$isSync='1'">
        <xsl:for-each select="method">
        /**
         * auto generated function declaration
         * for "<xsl:value-of select="@qname"/>" operation.
         <!--  select only the body parameters  -->
         <xsl:for-each select="input/param[@type!='']">* @param 
         */

        <xsl:variable name="outputours">
        <xsl:variable name="outputtype">
            <xsl:choose>
                <xsl:when test="output/param/@ours">adb__t*
                <xsl:otherwise>
            </xsl:choose>
        </xsl:variable>
        <xsl:choose>
        <xsl:when test="$outputtype=''">axis2_status_t
        <xsl:when test="$outputtype!=''">
        </xsl:choose>
        <xsl:text> 
        <xsl:value-of select="$method-prefix"/>_( axis2_stub_t *stub, const axutil_env_t *env,
                                                    <xsl:variable name="inputtype">
                                                        <xsl:if test="@ours">adb__t*
                                                    </xsl:variable>
                                                    <xsl:if test="position()>1">, 
                                                </xsl:for-each>);
        </xsl:for-each>
        </xsl:if>  

        <!-- Async method prototype generation -->
        <xsl:if test="$isAsync='1'">
        <xsl:for-each select="method">
        /**
         * auto generated function declaration
         * for "<xsl:value-of select="@qname"/>" operation.
         <!--  select only the body parameters  -->
         <xsl:for-each select="input/param[@type!='']">* @param 
         * @param on_complete callback to handle on complete
         * @param on_error callback to handle on error
         */

        <xsl:variable name="mep">
        <xsl:if test="$mep='12'">
        void <xsl:value-of select="$method-prefix"/>__start( axis2_stub_t *stub, const axutil_env_t *env,
                                                        <xsl:variable name="inputtype">
                                                            <xsl:if test="@ours">adb__t*
                                                        </xsl:variable>
                                                        <xsl:if test="position()>1">, 
                                                    </xsl:for-each>,
                                                        axis2_status_t ( AXIS2_CALL *on_complete ) (struct axis2_callback *, const axutil_env_t* ) ,
                                                        axis2_status_t ( AXIS2_CALL *on_error ) (struct axis2_callback *, const axutil_env_t*, int ) );

        </xsl:if>  
        </xsl:for-each>
        </xsl:if>  
   </xsl:template>
</xsl:stylesheet>

Other Axis 2 examples (source code examples)

Here is a short list of links related to this Axis 2 StubHeaderTemplate.xsl source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.