You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Fred Preston <PR...@uk.ibm.com> on 2004/06/16 17:39:01 UTC

Adding Attributes to SOAP message




Hi All,
      I need to be able to add attributes and namespaces to SOAP elements
as follows:-

<body>
   <ns1:main ns1:xmlns="www.xyz.com">
      <element  xmlns="www.xyz.com/local1" attribute="id1">
      </element >
      <element  xmlns="www.xyz.com/local2" attribute="id2">
      </element >
   </n1s:main>
</body>

      The code exists within AXIS to add attributes and local namespaces to
the 'operation', but there is no external API call that allows this.  I
have written code to allow the stub to add attributes to an operation (as
follows).  I would like to submit this for review and possible inclusion in
future AXIS releases.  The 'new' code is in bold.

File: Call.h
(at around line 100)

/* Method that set the remote method name */
void (AXISCALL* SetOperation)(void* pObj, const char* pchOperation, const
char* pchNamespace);
int (AXISCALL* SetEndpointURI)(void* pObj, const char* pchEndpointURI);
void (AXISCALL* AddOperationAttribute)(void* pObj, const char*
pchOperation, const char* pchName, const char* pchValue);

(at around line 184)

/* Method that set the remote method name */
virtual void AXISCALL SetOperation(const char* pchOperation, const char*
pchNamespace)=0;
virtual int AXISCALL SetEndpointURI(const char* pchEndpointURI)=0;
virtual void AXISCALL AddOperationAttribute(const char* pchOperation, const
char* pchName, const char* pchValue)=0;

(at around line 274)

/* Method that set the remote method name */
static void AXISCALL s_SetOperation(void* pObj, const char* pchOperation,
const char* pchNamespace)
{ ((CallBase*)pObj)->SetOperation(pchOperation, pchNamespace); };
static int AXISCALL s_SetEndpointURI(void* pObj, const char*
pchEndpointURI)
{ return ((CallBase*)pObj)->SetEndpointURI(pchEndpointURI); };
static void AXISCALL s_AddOperationAttribute(void* pObj, const char*
pchOperation, const char* pchName, const char* pchValue)
{ ((CallBase*)pObj)->AddOperationAttribute(pchOperation, pchName,
pchValue); };

(at around line 399)

static void s_Initialize()
{
      if (bInitialized) return;
      bInitialized = true;
      ms_VFtable.SetSOAPVersion = s_SetSOAPVersion;
      ms_VFtable.SetTransportProperty = s_SetTransportProperty;
      ms_VFtable.SetProtocol = s_SetProtocol;
      ms_VFtable.Initialize = s_InitializeCall;
      ms_VFtable.Invoke = s_Invoke;
      ms_VFtable.UnInitialize = s_UnInitialize;
      ms_VFtable.SetOperation = s_SetOperation;
      ms_VFtable.SetEndpointURI = s_SetEndpointURI;
      ms_VFtable.AddOperationAttribute = s_AddOperationAttribute;

(at around line 479)

/* Method that set the remote method name */
void AXISCALL SetOperation(const char* pchOperation, const char*
pchNamespace);
int AXISCALL SetEndpointURI(const char* pchEndpointURI);
void AXISCALL AddOperationAttribute(const char* pchOperation, const char*
pchName, const char* pchValue);

Call.cpp
(at around line 90)

void Call::AddParameter (void* pValue, const char* pchName, XSDTYPE nType)
{
    m_pIWSSZ->AddOutputParam (pchName, pValue, nType);
}

void Call::AddOperationAttribute (const char* pOperation, const char*
pName, const char* pValue)
{
    m_pIWSSZ->AddAttribute (pOperation, pName, pValue);
}

I am also looking at an update to include namespaces into the operation.

Regards,

Fred Preston.
Software Engineer
Business Integration

Mail Point 188,  IBM Hursley Park
Winchester, Hampshire, SO21 2JN, UK
Notes id:    Fred Preston/UK/IBM @ IBMGB
Internet:      prestonf@uk.ibm.com
Tel:             +44 1962 817180
Internal:      247180


Re: Adding Attributes to SOAP message

Posted by Susantha Kumara <su...@opensource.lk>.
Hi Fred,

These functionalities had already been added to Stub.h and are available
in 1.2 Alpha release. Also in the CVS HEAD.

Susantha.
---

On Wed, 2004-06-16 at 21:39, Fred Preston wrote:
> 
> Hi All,
>       I need to be able to add attributes and namespaces to SOAP elements
> as follows:-
> 
> <body>
>    <ns1:main ns1:xmlns="www.xyz.com">
>       <element  xmlns="www.xyz.com/local1" attribute="id1">
>       </element >
>       <element  xmlns="www.xyz.com/local2" attribute="id2">
>       </element >
>    </n1s:main>
> </body>
> 
>       The code exists within AXIS to add attributes and local namespaces to
> the 'operation', but there is no external API call that allows this.  I
> have written code to allow the stub to add attributes to an operation (as
> follows).  I would like to submit this for review and possible inclusion in
> future AXIS releases.  The 'new' code is in bold.
> 
> File: Call.h
> (at around line 100)
> 
> /* Method that set the remote method name */
> void (AXISCALL* SetOperation)(void* pObj, const char* pchOperation, const
> char* pchNamespace);
> int (AXISCALL* SetEndpointURI)(void* pObj, const char* pchEndpointURI);
> void (AXISCALL* AddOperationAttribute)(void* pObj, const char*
> pchOperation, const char* pchName, const char* pchValue);
> 
> (at around line 184)
> 
> /* Method that set the remote method name */
> virtual void AXISCALL SetOperation(const char* pchOperation, const char*
> pchNamespace)=0;
> virtual int AXISCALL SetEndpointURI(const char* pchEndpointURI)=0;
> virtual void AXISCALL AddOperationAttribute(const char* pchOperation, const
> char* pchName, const char* pchValue)=0;
> 
> (at around line 274)
> 
> /* Method that set the remote method name */
> static void AXISCALL s_SetOperation(void* pObj, const char* pchOperation,
> const char* pchNamespace)
> { ((CallBase*)pObj)->SetOperation(pchOperation, pchNamespace); };
> static int AXISCALL s_SetEndpointURI(void* pObj, const char*
> pchEndpointURI)
> { return ((CallBase*)pObj)->SetEndpointURI(pchEndpointURI); };
> static void AXISCALL s_AddOperationAttribute(void* pObj, const char*
> pchOperation, const char* pchName, const char* pchValue)
> { ((CallBase*)pObj)->AddOperationAttribute(pchOperation, pchName,
> pchValue); };
> 
> (at around line 399)
> 
> static void s_Initialize()
> {
>       if (bInitialized) return;
>       bInitialized = true;
>       ms_VFtable.SetSOAPVersion = s_SetSOAPVersion;
>       ms_VFtable.SetTransportProperty = s_SetTransportProperty;
>       ms_VFtable.SetProtocol = s_SetProtocol;
>       ms_VFtable.Initialize = s_InitializeCall;
>       ms_VFtable.Invoke = s_Invoke;
>       ms_VFtable.UnInitialize = s_UnInitialize;
>       ms_VFtable.SetOperation = s_SetOperation;
>       ms_VFtable.SetEndpointURI = s_SetEndpointURI;
>       ms_VFtable.AddOperationAttribute = s_AddOperationAttribute;
> 
> (at around line 479)
> 
> /* Method that set the remote method name */
> void AXISCALL SetOperation(const char* pchOperation, const char*
> pchNamespace);
> int AXISCALL SetEndpointURI(const char* pchEndpointURI);
> void AXISCALL AddOperationAttribute(const char* pchOperation, const char*
> pchName, const char* pchValue);
> 
> Call.cpp
> (at around line 90)
> 
> void Call::AddParameter (void* pValue, const char* pchName, XSDTYPE nType)
> {
>     m_pIWSSZ->AddOutputParam (pchName, pValue, nType);
> }
> 
> void Call::AddOperationAttribute (const char* pOperation, const char*
> pName, const char* pValue)
> {
>     m_pIWSSZ->AddAttribute (pOperation, pName, pValue);
> }
> 
> I am also looking at an update to include namespaces into the operation.
> 
> Regards,
> 
> Fred Preston.
> Software Engineer
> Business Integration
> 
> Mail Point 188,  IBM Hursley Park
> Winchester, Hampshire, SO21 2JN, UK
> Notes id:    Fred Preston/UK/IBM @ IBMGB
> Internet:      prestonf@uk.ibm.com
> Tel:             +44 1962 817180
> Internal:      247180
> 
>