Hi Adrian, I tried to follow Axis doc on Handlers – and it does not work for me – it looks like that the code of the handlers is executing before Soap message has been created.
The content of client.wsdd: <?xml version="1.0" encoding="UTF-8"?> <deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:C="http://xml.apache.org/axis/wsdd/providers/c"> <globalConfiguration> <requestFlow> <handler name="PolicyDecision" type="C:\Projects\Apache\Axis\lib\PolicyDecisionHandler.dll"/> </requestFlow> <responseFlow> <handler name="PolicyDecision" type="C:\Projects\Apache\Axis\lib\PolicyDecisionHandler.dll"/> </responseFlow> </globalConfiguration> <transport name ="http" > <requestFlow> <handler name="PolicyDecision" type="C:\Projects\Apache\Axis\lib\PolicyDecisionHandler.dll"/> </requestFlow> <responseFlow> <handler name="PolicyDecision" type="C:\Projects\Apache\Axis\lib\PolicyDecisionHandler.dll"/> </responseFlow> </transport> </deployment> The Handler code: int PolicyHandler::invoke(void *pvIMsg) { // cout << "file = " << __FILE__ << ", method = " << __FUNCTION__ << endl; IMessageData* pIMsg = (IMessageData*) pvIMsg; IHandlerSoapSerializer* pISZ; pIMsg->getSoapSerializer(&pISZ); IHandlerSoapDeSerializer* pIDZ; pIMsg->getSoapDeSerializer(&pIDZ); AxisChar* pSoapBody = 0; if( pIMsg->isPastPivot() ) {/*this is a response*/ cout << "file = " << __FILE__ << ", method = " << __FUNCTION__ << ", This is a response!!!" << endl; (1) pSoapBody = (char*)pISZ->getBodyAsString(); // returns 0 (as implemented) (3) pSoapBody = pIDZ->getBodyAsChar(); // just try if works here, throws an exception } else { /*this is a request*/ cout << "file = " << __FILE__ << ", method = " << __FUNCTION__ << ", This is a request!!!" << endl; try { // set new body for calculator service (2) pIDZ->setNewSoapBody((char*)"<ns1:div xmlns:ns1=\"http://tempuri.org/\"><ns1:in0>10000</ns1:in0><ns1:in1>10</ns1:in1></ns1:div>"); (3) pSoapBody = pIDZ->getBodyAsChar(); // throws an exception } catch ( ... ) { cout << "file = " << __FILE__ << ", method = " << __FUNCTION__ << ", error when request" << endl; } } return AXIS_SUCCESS; } (1) returns 0 (2) executes, can see in trace, however the body have not really changed (3) throws and exceptions Could you please give me advice/hint – what is wrong PLEASE HELP Thank you and best regards, Leonid Thank you, Leonid Adrian Dick wrote: > > Hi, > > I'd recommend you read the Handler Tutorial here : > http://ws.apache.org/axis/cpp/arch/handler.html > > Personally, I would advise only to modify the soap headers and not the > soap > body within handlers in Axis C++. > The APIs you can use are made available through the IMessageData object ( > [axis install]/include/axis/IMessageData.hpp ). > > Regards, > Adrian > _______________________________________ > Adrian Dick ([EMAIL PROTECTED]) > > > Krankurs Leonid <[EMAIL PROTECTED]> wrote on 11/09/2006 14:02:53: > >> >> Could anybody please clarify if the following can be done by Axis C++ 1.6 >> client side >> (all methods that needed have been implemented already in Axis C++ 1.6 >> build) >> >> 1. Handler can change the soap body of the message on request/response > path >> 2. if (1) yes, how the handler(s) needs to be configured in client.wsdd? >> 2.0. from what base class should the handler be derived >> 2.1. what type(level) of the handler should it be (service, global, >> transport) > This depends on the behaviour you're expecting. > service - this handler is used when invoking a given service - you can > specify the same handler for more than one service > global - this handler is used when invoking any service > transport - Due to only supporting HTTP(S) this is equivalent to global > for > Axis C++. > > >> 2.2. should the handler be explicitly configured to be in a chain? >> >> 2.3. What methods should be used on request path to get the current body, >> change the body, set the new body >> 2.4. What methods should be used on response path to get the current > body, >> change the body, set the new body > >> >> Could you please give any samples or link(s) to samples? > See the Handler Tutorial here : > http://ws.apache.org/axis/cpp/arch/handler.html > You will need to use the APIs made available through IMessageData ( [axis > install]/include/axis/IMessageData.hpp ) > >> >> >> Thank you, >> >> -- >> View this message in context: http://www.nabble.com/Handlers%2C- >> client.wsdd%2C-change-soap-body-on-request-response-path-tf2252258. >> html#a6246232 >> Sent from the Axis - C++ - User forum at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > -- View this message in context: http://www.nabble.com/Handlers%2C-client.wsdd%2C-change-soap-body-on-request-response-path-tf2252258.html#a6253463 Sent from the Axis - C++ - User forum at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
