You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ha...@apache.org on 2004/08/20 11:40:11 UTC
cvs commit: ws-axis/c/src/engine/client Call.cpp Stub.cpp
hawkeye 2004/08/20 02:40:11
Modified: c/include/axis/client Call.h Stub.h
c/src/engine/client Call.cpp Stub.cpp
Log:
Addition of ability to pass context information to handler from client applications, as a property.
Submitted by: Mark Whitlock
Reviewed by: Adrian Dick / John Hawkins
Revision Changes Path
1.26 +10 -0 ws-axis/c/include/axis/client/Call.h
Index: Call.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/client/Call.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- Call.h 6 Aug 2004 14:44:20 -0000 1.25
+++ Call.h 20 Aug 2004 09:40:11 -0000 1.26
@@ -79,6 +79,8 @@
void (AXISCALL* setSOAPVersion)(void* pObj, SOAP_VERSION version);
int (AXISCALL* setTransportProperty)(void* pObj,
AXIS_TRANSPORT_INFORMATION_TYPE type, const char* value);
+ int (AXISCALL* setHandlerProperty)(void* pObj,
+ AxisChar* name, void* value, int len);
int (AXISCALL* setProtocol)(void* pObj, AXIS_PROTOCOL_TYPE protocol);
int (AXISCALL* initialize)(void* pObj, PROVIDERTYPE nStyle, int secure);
int (AXISCALL* invoke)(void* pObj);
@@ -241,6 +243,8 @@
virtual void AXISCALL setSOAPVersion(SOAP_VERSION version)=0;
virtual int AXISCALL setTransportProperty(AXIS_TRANSPORT_INFORMATION_TYPE
type, const char* value)=0;
+ virtual int AXISCALL setHandlerProperty(AxisChar* name,
+ void* value, int len)=0;
virtual int AXISCALL setProtocol(AXIS_PROTOCOL_TYPE protocol)=0;
virtual int AXISCALL initialize(PROVIDERTYPE nStyle, int secure)=0;
virtual int AXISCALL invoke()=0;
@@ -399,6 +403,9 @@
static int AXISCALL s_SetTransportProperty(void* pObj,
AXIS_TRANSPORT_INFORMATION_TYPE type, const char* value)
{ return ((CallBase*)pObj)->setTransportProperty(type,value);};
+ static int AXISCALL s_SetHandlerProperty(void* pObj,
+ AxisChar* name, void* value, int len)
+ { return ((CallBase*)pObj)->setHandlerProperty(name,value,len);};
static int AXISCALL s_SetProtocol(void* pObj, AXIS_PROTOCOL_TYPE protocol)
{ return ((CallBase*)pObj)->setProtocol(protocol);};
static int AXISCALL s_InitializeCall(void* pObj, PROVIDERTYPE nStyle,
@@ -624,6 +631,7 @@
void AXISCALL setSOAPVersion(SOAP_VERSION version);
int AXISCALL setTransportProperty(AXIS_TRANSPORT_INFORMATION_TYPE type,
const char* value);
+ int AXISCALL setHandlerProperty(AxisChar* name, void* value, int len);
int AXISCALL setProtocol(AXIS_PROTOCOL_TYPE protocol);
int AXISCALL unInitialize();
int AXISCALL initialize(PROVIDERTYPE nStyle, int secure);
@@ -790,6 +798,8 @@
private:
ClientAxisEngine* m_pAxisEngine;
+ list<void*> m_handlerProperties;
+
/*
Following are pointers to relevant objects of the ClientAxisEngine
instance. So they do not belong to this object and are not created
1.19 +14 -0 ws-axis/c/include/axis/client/Stub.h
Index: Stub.h
===================================================================
RCS file: /home/cvs/ws-axis/c/include/axis/client/Stub.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Stub.h 6 Aug 2004 14:44:20 -0000 1.18
+++ Stub.h 20 Aug 2004 09:40:11 -0000 1.19
@@ -97,6 +97,8 @@
void (AXISCALL* deleteCurrentTrasportProperty)(void* pObj);
void (AXISCALL* deleteTrasportProperty)(void* pObj, char* pcKey,
unsigned int uiOccurance);
+ void (AXISCALL* setHandlerProperty)(void* pObj, AxisChar* name,
+ void* value, int len);
HeaderBlock_C (AXISCALL* createSOAPHeaderBlock)(void* pObj,
AxisChar * pachLocalName, AxisChar * pachUri);
HeaderBlock_C (AXISCALL* getFirstSOAPHeaderBlock)(void* pObj);
@@ -286,6 +288,15 @@
void deleteTrasportProperty(char* pcKey, unsigned int uiOccurance = 1);
/**
+ * Sets a property that can be accessed from a handler.
+ *
+ * @param name The name of the property
+ * @param value The value of the property
+ * @param len The length of the value
+ */
+ void setHandlerProperty(AxisChar* name, void* value, int len);
+
+ /**
* Create and add a SOAP header block to the Stub.
*
* This will create a header block that would look like the following when
@@ -557,6 +568,9 @@
static void AXISCALL s_deleteTrasportProperty(void* pObj, char* pcKey,
unsigned int uiOccurance)
{((Stub*)pObj)->deleteTrasportProperty(pcKey, uiOccurance);};
+ static void AXISCALL s_setHandlerProperty(void* pObj, AxisChar* name,
+ void* value, int len)
+ {((Stub*)pObj)->setHandlerProperty(name, value, len);};
static HeaderBlock_C AXISCALL s_createSOAPHeaderBlock(void* pObj,
AxisChar * pachLocalName, AxisChar * pachUri);
static HeaderBlock_C AXISCALL s_getFirstSOAPHeaderBlock(void* pObj);
1.55 +33 -0 ws-axis/c/src/engine/client/Call.cpp
Index: Call.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Call.cpp,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- Call.cpp 6 Aug 2004 14:44:34 -0000 1.54
+++ Call.cpp 20 Aug 2004 09:40:11 -0000 1.55
@@ -110,6 +110,13 @@
return m_nStatus;
}
+typedef struct
+{
+ AxisChar *name;
+ void *value;
+ int len;
+} HandlerPropertyData;
+
int Call::initialize (PROVIDERTYPE nStyle, int secure)
/* Does this mean that the stub that uses this Call object as well as all
* client side handlers have the same PROVIDERTYPE ?
@@ -138,6 +145,16 @@
m_pMsgData = m_pAxisEngine->getMessageData ();
if (m_pMsgData)
{
+ list<void*>::iterator it = m_handlerProperties.begin();
+ while (it != m_handlerProperties.end())
+ {
+ HandlerPropertyData *pHpi = (HandlerPropertyData*)(*it);
+ m_pMsgData->setProperty(pHpi->name, pHpi->value, pHpi->len);
+ free(pHpi);
+ it++;
+ }
+ m_handlerProperties.clear();
+
m_pMsgData->getSoapSerializer ((IWrapperSoapSerializer**)
(&m_pIWSSZ));
m_pMsgData->getSoapDeSerializer ((IWrapperSoapDeSerializer**)
@@ -219,6 +236,21 @@
return AXIS_SUCCESS;
}
+int Call::setHandlerProperty(AxisChar* name, void* value, int len)
+{
+ // Unfortunately we have to cache the handler properties here
+ // in the Call object since the m_pMsgData is not set up
+ // until Call::initialize which doesn't happen until the actual
+ // web service is invoked.
+ HandlerPropertyData* pHpi =
+ (HandlerPropertyData*) malloc(sizeof(HandlerPropertyData));
+ pHpi->name = name;
+ pHpi->value = value;
+ pHpi->len = len;
+ m_handlerProperties.push_back(pHpi);
+ return AXIS_SUCCESS;
+}
+
/*
* This method takes a look at the m_Soap structure and open
* transport layer connection to the server. Then this adds the
@@ -616,6 +648,7 @@
bInitialized = true;
ms_VFtable.setSOAPVersion = s_SetSOAPVersion;
ms_VFtable.setTransportProperty = s_SetTransportProperty;
+ ms_VFtable.setHandlerProperty = s_SetHandlerProperty;
ms_VFtable.setProtocol = s_SetProtocol;
ms_VFtable.initialize = s_InitializeCall;
ms_VFtable.invoke = s_Invoke;
1.16 +6 -0 ws-axis/c/src/engine/client/Stub.cpp
Index: Stub.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/engine/client/Stub.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- Stub.cpp 6 Jul 2004 14:16:46 -0000 1.15
+++ Stub.cpp 20 Aug 2004 09:40:11 -0000 1.16
@@ -171,6 +171,11 @@
}
}
+void Stub::setHandlerProperty(AxisChar* name, void* value, int len)
+{
+ m_pCall->setHandlerProperty(name, value, len);
+}
+
IHeaderBlock* Stub::createSOAPHeaderBlock(AxisChar * pachLocalName,
AxisChar * pachUri)
{
@@ -475,6 +480,7 @@
ms_VFtable.getCurrentTrasportPropertyValue = s_getCurrentTrasportPropertyValue;
ms_VFtable.deleteCurrentTrasportProperty = s_deleteCurrentTrasportProperty;
ms_VFtable.deleteTrasportProperty = s_deleteTrasportProperty;
+ ms_VFtable.setHandlerProperty = s_setHandlerProperty;
ms_VFtable.createSOAPHeaderBlock = s_createSOAPHeaderBlock;
ms_VFtable.getFirstSOAPHeaderBlock = s_getFirstSOAPHeaderBlock;
ms_VFtable.getNextSOAPHeaderBlock = s_getNextSOAPHeaderBlock;