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/05/25 19:07:51 UTC

Adding Attributes




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


Re: The Stub base class

Posted by Roshan Weerasuriya <ro...@opensource.lk>.
hi samisa,

This is a good approach which you have come up to live with existing stuff, 
for the moment. I added few thing to let this code run on windows, and few 
required methods.

 >    Soap body attributes, transport timeouts etc. could be made to set at 
stub level using this
 > Stub class

added setting method attributes.

 >however there were problems adding content into a
 > header

Fixed it.

 >Also I did not test this on Windows, hence please test on windows.

Tested.

rgds,
Roshan


rgds,
Roshan

rgds,
Roshan

At 05:42 AM 5/26/2004 -0700, you wrote:
>I updated the WSDL2WS tool to eneble the generated stub to inherit from 
>Stub base class.
>I only changed the java code for cpp and cpp/literal client stub generation.
>The Stub class should be wrapped for the C services to expose the set/get 
>interface for SOAP/HTTP
>headers. This task is still TODO.
>
>Thanks,
>Samisa...
>
>--- Samisa Abeysinghe <sa...@yahoo.com> wrote:
> > Roshan,
> >    I commited the Stub class.
> >    The test application is in tests/client/stubTest/stubBase folder.
> >    Stub.h is in include/axis/client and Stub.cpp in src/engine/client
> >
> >    Please use the test sample and improve the Stub class until the java 
> tool is updated. (add
> > get/remove methods)
> >
> >    Soap body attributes, transport timeouts etc. could be made to set 
> at stub level using this
> > Stub class.
> >
> >    I tested the class on Linux and it worked, however there were 
> problems adding content into a
> > header. Also I did not test this on Windows, hence please test on windows.
> >
> > Thanks,
> > Samisa...
> >
> > --- Samisa Abeysinghe <sa...@yahoo.com> wrote:
> > > Hi All,
> > >    At last, here it is!!! (see below)
> > >    I had to do many changes like adding copy constructors to get this 
> stub working.
> > >    The hard part was not to write this stub class, but to get the 
> rest of the code behave in a
> > > way
> > > to support setting SOAP/Transport headers.
> > >    I have commited the changes to other classes but not this Stub class.
> > >
> > >    I tested this and it works. This means that at the stub level, 
> HTTP headers, SOAP headers
> > > could
> > > be set.
> > > Sample usage:
> > >     InteropTestPortType ws(endpoint); //create stub object
> > >     ws.setEndPoint( "http://localhost:8080/axis/services/echo" );
> > >     ws.setTransportProperty( "Accept-Language", " da, en-gb;q=0.8, 
> en;q=0.7" );
> > >     IHeaderBlock* phb = ws.createHeaderBlock( "Trans", "m",
> > "http://ws.apache.org/axisCppTest/"
> > > );
> > >
> > >    However there remains much more work: change stub generation to 
> inherit from this class;
> > add
> > > get/remove methods for SOAP/HTTP header manipulation etc...
> > >
> > >    Your comments on this are welcome.
> > > Thanks,
> > > Samisa...
> > >
> > > class Stub
> > > {
> > > public:
> > >         Stub(const char* pchEndpointUri);
> > >         virtual ~Stub();
> > >         int initilizeCall();
> > >         void setEndPoint(char* pcEndPoint);
> > >         void setTransportProperty(const char* pcKey, const char* 
> pcValue);
> > >         IHeaderBlock* createHeaderBlock(AxisChar *pachLocalName,
> > >                 AxisChar *pachPrefix, AxisChar *pachUri);
> > >
> > > protected:
> > >         void setTransportProperties();
> > >         void setSOAPHeaders();
> > >         Call* m_pCall;
> > >         vector <char*> m_vKeys;
> > >         vector <char*> m_vValues;
> > >         vector <IHeaderBlock*> m_vSOAPHeaderBlocks;
> > >
> > > };
> > >
> > >
> > >
> > >
> > >
> > > __________________________________
> > > Do you Yahoo!?
> > > Friends.  Fun.  Try the all-new Yahoo! Messenger.
> > > http://messenger.yahoo.com/
> >
> >
> >
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Friends.  Fun.  Try the all-new Yahoo! Messenger.
> > http://messenger.yahoo.com/
>
>
>
>
>
>__________________________________
>Do you Yahoo!?
>Friends.  Fun.  Try the all-new Yahoo! Messenger.
>http://messenger.yahoo.com/




Re: The Stub base class

Posted by Samisa Abeysinghe <sa...@yahoo.com>.
I updated the WSDL2WS tool to eneble the generated stub to inherit from Stub base class.
I only changed the java code for cpp and cpp/literal client stub generation.
The Stub class should be wrapped for the C services to expose the set/get interface for SOAP/HTTP
headers. This task is still TODO.

Thanks,
Samisa...

--- Samisa Abeysinghe <sa...@yahoo.com> wrote:
> Roshan,
>    I commited the Stub class.
>    The test application is in tests/client/stubTest/stubBase folder.
>    Stub.h is in include/axis/client and Stub.cpp in src/engine/client
> 
>    Please use the test sample and improve the Stub class until the java tool is updated. (add
> get/remove methods)
>    
>    Soap body attributes, transport timeouts etc. could be made to set at stub level using this
> Stub class. 
> 
>    I tested the class on Linux and it worked, however there were problems adding content into a
> header. Also I did not test this on Windows, hence please test on windows.
> 
> Thanks,
> Samisa...
> 
> --- Samisa Abeysinghe <sa...@yahoo.com> wrote:
> > Hi All,
> >    At last, here it is!!! (see below)
> >    I had to do many changes like adding copy constructors to get this stub working.
> >    The hard part was not to write this stub class, but to get the rest of the code behave in a
> > way
> > to support setting SOAP/Transport headers.
> >    I have commited the changes to other classes but not this Stub class.
> > 
> >    I tested this and it works. This means that at the stub level, HTTP headers, SOAP headers
> > could
> > be set.
> > Sample usage:
> >     InteropTestPortType ws(endpoint); //create stub object
> >     ws.setEndPoint( "http://localhost:8080/axis/services/echo" );
> >     ws.setTransportProperty( "Accept-Language", " da, en-gb;q=0.8, en;q=0.7" );
> >     IHeaderBlock* phb = ws.createHeaderBlock( "Trans", "m",
> "http://ws.apache.org/axisCppTest/"
> > );
> > 
> >    However there remains much more work: change stub generation to inherit from this class;
> add
> > get/remove methods for SOAP/HTTP header manipulation etc...
> > 
> >    Your comments on this are welcome.
> > Thanks,
> > Samisa...
> > 
> > class Stub
> > {
> > public:
> >         Stub(const char* pchEndpointUri);
> >         virtual ~Stub();
> >         int initilizeCall();
> >         void setEndPoint(char* pcEndPoint);
> >         void setTransportProperty(const char* pcKey, const char* pcValue);
> >         IHeaderBlock* createHeaderBlock(AxisChar *pachLocalName,
> >                 AxisChar *pachPrefix, AxisChar *pachUri);
> > 
> > protected:
> >         void setTransportProperties();
> >         void setSOAPHeaders();
> >         Call* m_pCall;
> >         vector <char*> m_vKeys;
> >         vector <char*> m_vValues;
> >         vector <IHeaderBlock*> m_vSOAPHeaderBlocks;
> > 
> > };
> > 
> > 
> > 
> > 	
> > 		
> > __________________________________
> > Do you Yahoo!?
> > Friends.  Fun.  Try the all-new Yahoo! Messenger.
> > http://messenger.yahoo.com/ 
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

Re: The Stub base class

Posted by Samisa Abeysinghe <sa...@yahoo.com>.
Roshan,
   I commited the Stub class.
   The test application is in tests/client/stubTest/stubBase folder.
   Stub.h is in include/axis/client and Stub.cpp in src/engine/client

   Please use the test sample and improve the Stub class until the java tool is updated. (add
get/remove methods)
   
   Soap body attributes, transport timeouts etc. could be made to set at stub level using this
Stub class. 

   I tested the class on Linux and it worked, however there were problems adding content into a
header. Also I did not test this on Windows, hence please test on windows.

Thanks,
Samisa...

--- Samisa Abeysinghe <sa...@yahoo.com> wrote:
> Hi All,
>    At last, here it is!!! (see below)
>    I had to do many changes like adding copy constructors to get this stub working.
>    The hard part was not to write this stub class, but to get the rest of the code behave in a
> way
> to support setting SOAP/Transport headers.
>    I have commited the changes to other classes but not this Stub class.
> 
>    I tested this and it works. This means that at the stub level, HTTP headers, SOAP headers
> could
> be set.
> Sample usage:
>     InteropTestPortType ws(endpoint); //create stub object
>     ws.setEndPoint( "http://localhost:8080/axis/services/echo" );
>     ws.setTransportProperty( "Accept-Language", " da, en-gb;q=0.8, en;q=0.7" );
>     IHeaderBlock* phb = ws.createHeaderBlock( "Trans", "m", "http://ws.apache.org/axisCppTest/"
> );
> 
>    However there remains much more work: change stub generation to inherit from this class; add
> get/remove methods for SOAP/HTTP header manipulation etc...
> 
>    Your comments on this are welcome.
> Thanks,
> Samisa...
> 
> class Stub
> {
> public:
>         Stub(const char* pchEndpointUri);
>         virtual ~Stub();
>         int initilizeCall();
>         void setEndPoint(char* pcEndPoint);
>         void setTransportProperty(const char* pcKey, const char* pcValue);
>         IHeaderBlock* createHeaderBlock(AxisChar *pachLocalName,
>                 AxisChar *pachPrefix, AxisChar *pachUri);
> 
> protected:
>         void setTransportProperties();
>         void setSOAPHeaders();
>         Call* m_pCall;
>         vector <char*> m_vKeys;
>         vector <char*> m_vValues;
>         vector <IHeaderBlock*> m_vSOAPHeaderBlocks;
> 
> };
> 
> 
> 
> 	
> 		
> __________________________________
> Do you Yahoo!?
> Friends.  Fun.  Try the all-new Yahoo! Messenger.
> http://messenger.yahoo.com/ 



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

The Stub base cllass

Posted by Samisa Abeysinghe <sa...@yahoo.com>.
Hi All,
   At last, here it is!!! (see below)
   I had to do many changes like adding copy constructors to get this stub working.
   The hard part was not to write this stub class, but to get the rest of the code behave in a way
to support setting SOAP/Transport headers.
   I have commited the changes to other classes but not this Stub class.

   I tested this and it works. This means that at the stub level, HTTP headers, SOAP headers could
be set.
Sample usage:
    InteropTestPortType ws(endpoint); //create stub object
    ws.setEndPoint( "http://localhost:8080/axis/services/echo" );
    ws.setTransportProperty( "Accept-Language", " da, en-gb;q=0.8, en;q=0.7" );
    IHeaderBlock* phb = ws.createHeaderBlock( "Trans", "m", "http://ws.apache.org/axisCppTest/" );

   However there remains much more work: change stub generation to inherit from this class; add
get/remove methods for SOAP/HTTP header manipulation etc...

   Your comments on this are welcome.
Thanks,
Samisa...

class Stub
{
public:
        Stub(const char* pchEndpointUri);
        virtual ~Stub();
        int initilizeCall();
        void setEndPoint(char* pcEndPoint);
        void setTransportProperty(const char* pcKey, const char* pcValue);
        IHeaderBlock* createHeaderBlock(AxisChar *pachLocalName,
                AxisChar *pachPrefix, AxisChar *pachUri);

protected:
        void setTransportProperties();
        void setSOAPHeaders();
        Call* m_pCall;
        vector <char*> m_vKeys;
        vector <char*> m_vValues;
        vector <IHeaderBlock*> m_vSOAPHeaderBlocks;

};



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

RE: Adding Attributes

Posted by Susantha Kumara <su...@opensource.lk>.
Is there a way to indicate this in your wsdl ?. if it is doc/lit style
there should be a way .

---
Susantha Kumara
Virtusa (pvt) Ltd.
Office : +94112714385
Mobile : +94777420453

> -----Original Message-----
> From: Fred Preston [mailto:PRESTONF@uk.ibm.com]
> Sent: Tuesday, May 25, 2004 11:08 PM
> To: axis-c-dev@ws.apache.org
> Subject: Adding Attributes
> 
> 
> 
> 
> 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



Re: Adding Attributes

Posted by Roshan Weerasuriya <ro...@opensource.lk>.
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