Main Page   Class Hierarchy   Compound List   File List   Compound Members  

Call.h

00001 /*
00002  * The Apache Software License, Version 1.1
00003  *
00004  *
00005  * Copyright (c) 2003 The Apache Software Foundation.  All rights
00006  * reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions
00010  * are met:
00011  *
00012  * 1. Redistributions of source code must retain the above copyright
00013  *    notice, this list of conditions and the following disclaimer.
00014  *
00015  * 2. Redistributions in binary form must reproduce the above copyright
00016  *    notice, this list of conditions and the following disclaimer in
00017  *    the documentation and/or other materials provided with the
00018  *    distribution.
00019  *
00020  * 3. The end-user documentation included with the redistribution,
00021  *    if any, must include the following acknowledgment:
00022  *       "This product includes software developed by the
00023  *        Apache Software Foundation (http://www.apache.org/)."
00024  *    Alternately, this acknowledgment may appear in the software itself,
00025  *    if and wherever such third-party acknowledgments normally appear.
00026  *
00027  * 4. The names "SOAP" and "Apache Software Foundation" must
00028  *    not be used to endorse or promote products derived from this
00029  *    software without prior written permission. For written
00030  *    permission, please contact apache@apache.org.
00031  *
00032  * 5. Products derived from this software may not be called "Apache",
00033  *    nor may "Apache" appear in their name, without prior written
00034  *    permission of the Apache Software Foundation.
00035  *
00036  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
00037  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00038  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00039  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
00040  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
00041  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
00042  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
00043  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00044  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00045  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
00046  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
00047  * SUCH DAMAGE.
00048  * ====================================================================
00049  *
00050  * This software consists of voluntary contributions made by many
00051  * individuals on behalf of the Apache Software Foundation.  For more
00052  * information on the Apache Software Foundation, please see
00053  * <http://www.apache.org/>.
00054  *
00055  *
00056  *
00057  * @author Sanjaya Singharage (sanjayas@opensource.lk)
00058  * @author Susantha Kumara (susantha@opensource.lk, skumara@virtusa.com)
00059  *
00060  */
00061 
00062 // Call.h: interface for the Call class.
00063 //
00065 
00066 #if !defined(AFX_CALL_H__D13E5626_0A9B_43EA_B606_364B98CEDAA8__INCLUDED_)
00067 #define AFX_CALL_H__D13E5626_0A9B_43EA_B606_364B98CEDAA8__INCLUDED_
00068 
00069 #include "../common/IParam.h"
00070 #include "../engine/ClientAxisEngine.h"
00071 #include <list>
00072 using namespace std;
00073 
00074 class AxisTransport;
00075 
00076 /* A separate call class object should be used by each thread */
00077 class Call  
00078 {
00079 public:
00080         void SetSOAPVersion(SOAP_VERSION version);
00081         int SetHeader(char * key, char* value);
00082         int SetProtocol(AXIS_PROTOCOL_TYPE protocol);
00083         int UnInitialize();
00084         int Initialize();
00085         void GetResult(void** pReturn);
00086         Param* GetResult();
00087         void GetOutParam(void** pOut);
00088         Param* GetOutParam();
00089         int Invoke();
00090 
00091         /* Method to set that the return type is complex type */
00092         void SetReturnType(void* pDZFunct, void* pCreFunct, void* pDelFunct, const char* pchTypeName, const char* pchUri);
00093         /* Method to set that the return type is an array of complex types */
00094         void SetReturnType(Axis_Array* pArray, void* pDZFunct, void* pCreFunct, void* pDelFunct, void* pSizeFunct, const char* pchTypeName, const char* pchUri);
00095         /* Method to set that the return type is an array of basic types */
00096         void SetReturnType(Axis_Array* pArray, XSDTYPE nType);
00097         /* Method to set that the return type is basic type */
00098         void SetReturnType(XSDTYPE nType);
00099 
00100         /* Method to set that the return type is complex type */
00101         void AddOutParamType(void* pDZFunct, void* pCreFunct, void* pDelFunct, const char* pchTypeName, const char* pchUri);
00102         /* Method to set that the return type is an array of complex types */
00103         void AddOutParamType(Axis_Array* pArray, void* pDZFunct, void* pCreFunct, void* pDelFunct, void* pSizeFunct, const char* pchTypeName, const char* pchUri);
00104         /* Method to set that the return type is an array of basic types */
00105         void AddOutParamType(Axis_Array* pArray, XSDTYPE nType);
00106         /* Method to set that the return type is basic type */
00107         void AddOutParamType(XSDTYPE nType);
00108 
00109         /* Method for adding complex parameters */
00110         void AddParameter(void* pObject, void* pSZFunct, void* pDelFunct, const char* pchName);
00111         /* Method for adding complex type array parameters */
00112         void AddParameter(Axis_Array* pArray, void* pSZFunct, void* pDelFunct, void* pSizeFunct, const char* pchTypeName, const char* pchURI, const char* pchName);
00113         /* Method for adding basic type array parameters */
00114         void AddParameter(Axis_Array* pArray, XSDTYPE nType, const char* pchName);
00115 
00116         /* Methods for adding parameters of basic types */
00117         void AddParameter(int nValue,const char* pchName, XSDTYPE nType);
00118         void AddParameter(unsigned int unValue,const char* pchName, XSDTYPE nType);
00119         void AddParameter(short sValue,const char* pchName, XSDTYPE nType);
00120         void AddParameter(unsigned short usValue,const char* pchName, XSDTYPE nType);
00121         void AddParameter(long lValue,const char* pchName, XSDTYPE nType);
00122         void AddParameter(unsigned long ulValue,const char* pchName, XSDTYPE nType);
00123         void AddParameter(char cValue,const char* pchName, XSDTYPE nType);
00124         void AddParameter(unsigned char ucValue,const char* pchName, XSDTYPE nType);
00125         void AddParameter(float fValue,const char* pchName, XSDTYPE nType);
00126         void AddParameter(double dValue,const char* pchName, XSDTYPE nType);
00127         void AddParameter(struct tm tValue,const char* pchName, XSDTYPE nType);
00128         void AddParameter(const AxisChar* pStrValue,const char* pchName, XSDTYPE nType);
00129         void AddParameter(const AxisString& sStrValue,const char* pchName, XSDTYPE nType);
00130 
00131         /* Method that set the remote method name */
00132         void SetOperation(const char* pchOperation, const char* pchNamespace);
00133         int SetEndpointURI(const char* pchEndpointURI);
00134 
00135         Call();
00136         virtual ~Call();
00137 private:
00138         int OpenConnection();
00139         void CloseConnection();
00140         void InitializeObjects();
00141         int MakeArray();
00142 
00143 private:
00144         ClientAxisEngine* m_pAxisEngine;
00145         Param* m_pReturnValue;
00146         /* 
00147            Following are pointers to relevant objects of the ClientAxisEngine instance 
00148            So they do not belong to this object and are not created or deleted 
00149          */
00150         MessageData* m_pMsgData;
00151         SoapSerializer* m_pIWSSZ;
00152         SoapDeSerializer* m_pIWSDZ;
00153         /* 
00154            Return type of the remote method being called 
00155          */
00156         XSDTYPE m_nReturnType;
00157         /* 
00158            m_ReturnCplxObj is populated with the relevant function pointers to manipulate
00159            a custom type when the return type of a method call is a custom type or an array
00160            of custom types.
00161          */
00162         ComplexObjectHandler m_ReturnCplxObj;
00163         /* 
00164            m_Soap contains transport related information and function pointers to manipulate
00165            transport layer.
00166          */
00167         Ax_soapstream m_Soap;
00168         /*
00169            Transport object
00170          */
00171         AxisTransport* m_pTransport;
00172         /* 
00173            m_pArray will hold the Array object passed by the stub and will be 
00174            populated with deserialized elements when the response arrives.
00175          */
00176         Axis_Array* m_pArray;
00177         /*
00178            m_nArrayType will contain the type of an array element when the called method returns
00179            and array.
00180          */
00181         XSDTYPE m_nArrayType;
00182 
00183         class OutParamHolder
00184         {
00185         public:
00186                 Param* m_pOutValue;
00187                 /* 
00188                    Out param type of the remote method being called 
00189                  */
00190                 XSDTYPE m_nOutType;
00191                 /* 
00192                    m_OutCplxObj is populated with the relevant function pointers to manipulate
00193                    a custom type when the out param type of a method call is a custom type or an array
00194                    of custom types.
00195                  */
00196                 ComplexObjectHandler m_OutCplxObj;
00197                 /* 
00198                    m_pArray will hold the Array object passed by the stub and will be 
00199                    populated with deserialized elements when the response arrives.
00200                  */
00201                 Axis_Array* m_pArray;
00202                 /*
00203                    m_nArrayType will contain the type of an array element when the called method returns
00204                    and array.
00205                  */
00206                 XSDTYPE m_nArrayType;
00207 
00208                 OutParamHolder();
00209                 ~OutParamHolder();
00210         };
00211 
00212 private:
00213         list<OutParamHolder*> m_OutParams;
00214         list<OutParamHolder*>::iterator m_CurItr;
00215         Call::OutParamHolder* AddOutParam();
00216 };
00217 
00218 #endif // !defined(AFX_CALL_H__D13E5626_0A9B_43EA_B606_364B98CEDAA8__INCLUDED_)

Generated on Mon Dec 1 15:18:34 2003 for axisc++ by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002