axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roshan Weerasuriya <ros...@opensource.lk>
Subject Re: Adding Attributes
Date Tue, 01 Jun 2004 17:07:39 GMT
hi Fred,

The latest CVS code is capable of dealing with your requirement. Now users 
are able to add Attributes to the operation with the  method 
"setSOAPMethodAttribute(const AxisChar *pLocalname, const AxisChar 
*pPrefix, const AxisChar* pUri, const AxisChar *pValue);" which is 
available at the Stub class. The following example illustrates the use of this.

eg:

#include "Calculator.h"
#include <iostream>
#include <axis/server/CharacterElement.h>

int main() {

         Calculator objCalc("http://localhost:5555/axis/Calculator");

         IHeaderBlock* pIHeaderBlock = 
objCalc.createHeaderBlock("myHeaderBlock", "ns1", "http://mysite.com");
         BasicNode* pBasicNode = 
pIHeaderBlock->createImmediateChild(ELEMENT_NODE, "number", "ns2", 
"http://mysite2.com", "val");
         BasicNode* pBasicNode2 = 
pIHeaderBlock->createChild(CHARACTER_NODE, "", "", "", "testHeaderVal");
         pBasicNode->addChild(pBasicNode2);

         /*
         * Code to set Attributes to the soap operation
         */
         objCalc.setSOAPMethodAttribute("attr1", "ns1", "100");
         objCalc.setSOAPMethodAttribute("attr2", "ns1", "200");
         objCalc.setSOAPMethodAttribute("attr3", "", "www.mysite3.com", "300");

         cout<<objCalc.add(10, 20);
         return 0;
}

The generated SOAP Request from the Axis C++ client engine for the above 
example is given below.

<?xml version='1.0' encoding='utf-8' ?>
<SOAP-ENV:Envelope 
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header><ns1:myHeaderBlock 
xmlns:ns1="http://mysite.com"><ns2:number 
xmlns:ns2="http://mysite2.com">testHeaderVal</ns2:number></ns1:myHeaderBlock></SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:add xmlns:ns1="http://localhost/axis/Calculator" ns1:attr1="100" 
ns1:attr2="200" xmlns:ns2="www.mysite3.com" ns2:attr3="300">
<in0 xsi:type="xsd:int">10</in0>
<in1 xsi:type="xsd:int">20</in1>
</ns1:add>
</SOAP-ENV:Body></SOAP-ENV:Envelope>

rgds,
Roshan


At 07:12 PM 5/26/2004 -0700, you wrote:
>Hi Fred,
>    A richer API for the stub is being developed at the moment, so that 
> you could access the
>internal reatures of the engine through the stub.
>    At the moment, setting trasport and SOAP headers are being supporeted.
>    Your requirement is a new one; however with the current model I hope 
> this could be supported.
>Thanks,
>Samisa...
>
>--- Fred Preston <PRESTONF@uk.ibm.com> wrote:
> >
> >
> >
> >
> > Hi Roshan,
> >       Is there a way that I can do all this from outside ws-axis?  I have
> > created stubs from WSDL.  I have a 'main' which calls methods on the stubs
> > which call methods in axis.  All of the ws-axis object is behind the 'call'
> > API.  Is there a way to create an attribute and attach it to an operation
> > using this API?  Currently I have:-
> >
> > m_pCall->SetTransportPorperty(SOAPACTION_HEADER, "find_business")
> > m_pCall->SetSOAPVersion(SOAP_VER_1_1)
> > m_pCall->SetOperation( "find_business", "urn:uddi-org:api_v2");
> > m_pCall->AddParameter(...);
> >
> > But there is no API call that will allow me to add an attribute to the
> > SOAPObject that is created by SetOperation...  This is also true for the
> > AddParameter group.
> >
> > 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
> >
> >
> >
> > 
 >
> >
> >                       Roshan 
 >
> >
> >                       Weerasuriya              To:       "Apache AXIS C 
> Developers List"
> > <axis-c-dev@ws.apache.org>
> >                       <roshan@opensourc        cc: 
 >
> >
> >                       e.lk>                    Subject:  Re: Adding 
> Attributes
> >
> > 
 >
> >
> >                       26/05/04 
> 04:37
> >
> >                       Please respond 
> to
> >
> >                       "Apache AXIS 
> C
> >
> >                       Developers 
> List"
> >
> > 
 >
> >
> > 
 >
> >
> >
> >
> >
> > hi,
> >
> > SoapMethod has the method addAttribute(Attribute *pAttribute). You have to
> > create a Attribute object pointer with your data and set it.
> >
> > rgds,
> > Roshan
> >
> > At 06:07 PM 5/25/2004 +0100, you wrote:
> >
> >
> >
> > >Hi All,
> > >       How do I add attributes to the SOAP-BODY operation. e.g
> > >
> > >Currently have:
> > ><body>
> > >       <ns1:find_business xmlns:ns1="...">
> > >             <name>
> > >                   xxx
> > >             </name>
> > >       </ns1:find_business xmlns:ns1="...">
> > ></body>
> > >
> > >Would like:
> > ><body>
> > >       <ns1:find_business xmlns:ns1="..." generic="2.0">
> > >             <name>
> > >                   xxx
> > >             </name>
> > >       </ns1:find_business xmlns:ns1="...">
> > ></body>
> > >
> > >How do I add in the generic="2.0" attribute using ws-axis methods?
> > >
> > >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
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Friends.  Fun.  Try the all-new Yahoo! Messenger.
>http://messenger.yahoo.com/




Mime
View raw message