You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Sergej Srepfler <se...@jware.hr> on 2004/07/08 16:45:16 UTC

SOAPHeader and c++ client help needed

I am totally lost here.

I did find an example how to set an SOAPHeader from C++ client.
   /*create a header of the form:
       <SOAP-ENV:Header>
       <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
       <TestAuthHeader>
       <username>Test User</username>
       <password>Test Password</password>
       </TestAuthHeader>
       </th:newName>
       </SOAP-ENV:Header>
     */


    //set SOAP headers
    IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader",
                "http://ws.apache.org/axisCppTest/");

    //create parent node
    BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
    parentNode->setLocalName("Credentials");
    //create child node     
    BasicNode *childNode = phb->createChild(ELEMENT_NODE);
    childNode->setLocalName("username");
    //create char node for value
    BasicNode *valueNode = phb->createChild(CHARACTER_NODE);
    valueNode->setValue("Test User");
    //buld node tree
    childNode->addChild(valueNode);
    parentNode->addChild(childNode);

   //add another node set
    childNode = phb->createChild(ELEMENT_NODE);
    childNode->setLocalName("password");

    valueNode = phb->createChild(CHARACTER_NODE);
    valueNode->setValue("Test Password");

    childNode->addChild(valueNode);
    parentNode->addChild(childNode);

    phb->addChild(parentNode);

    and after that, I can call service.
    But - how do I read these fields? How to find out how the service
    changed these fields?


Re: SOAPHeader and c++ client help needed

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

Also you could do the same at Axis C++ Client Side. The mechanism is the
same: Write and configure a Client Side Response Flow Handler. (The
handler interns/implimentation/logic would look same as the Server Side
echoStringHeaderHandler detials) (look at the Axis C++ User Guide for
handlers and Axis C++ Architecture Guide for Request/Response Flow
details)

Roshan

On Sat, 2004-07-10 at 15:08, Roshan Weerasuriya wrote:
> hi,
> 
> >how do I read these fields?
> 
> If what you mean by read these fields is to read and manipulate them,
> then you will have to configure some server side Handlers inorder to do
> this. Have a look at the server side handler example at Axis C++. (at
> samples/server/echoStringHeaderHandler). The mecanism to manupulate with
> the SOAPHeaders in Axis C++ is through Handlers. (Have a look at the
> user guide Handlers seciton also)
> 
> Roshan
> 
> On Fri, 2004-07-09 at 08:37, Samisa Abeysinghe wrote:
> > You could use the tcpmon (java org.apache.axis.utils.tcpmon) that comes with Axis Java to trace
> > the request and response.
> > Unfortunately, there is no SOAP message level trace utility built into C++.
> > 
> > Samisa...
> > 
> > --- Sergej Srepfler <se...@jware.hr> wrote:
> > > I am totally lost here.
> > > 
> > > I did find an example how to set an SOAPHeader from C++ client.
> > >    /*create a header of the form:
> > >        <SOAP-ENV:Header>
> > >        <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
> > >        <TestAuthHeader>
> > >        <username>Test User</username>
> > >        <password>Test Password</password>
> > >        </TestAuthHeader>
> > >        </th:newName>
> > >        </SOAP-ENV:Header>
> > >      */
> > > 
> > > 
> > >     //set SOAP headers
> > >     IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader",
> > >                 "http://ws.apache.org/axisCppTest/");
> > > 
> > >     //create parent node
> > >     BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
> > >     parentNode->setLocalName("Credentials");
> > >     //create child node     
> > >     BasicNode *childNode = phb->createChild(ELEMENT_NODE);
> > >     childNode->setLocalName("username");
> > >     //create char node for value
> > >     BasicNode *valueNode = phb->createChild(CHARACTER_NODE);
> > >     valueNode->setValue("Test User");
> > >     //buld node tree
> > >     childNode->addChild(valueNode);
> > >     parentNode->addChild(childNode);
> > > 
> > >    //add another node set
> > >     childNode = phb->createChild(ELEMENT_NODE);
> > >     childNode->setLocalName("password");
> > > 
> > >     valueNode = phb->createChild(CHARACTER_NODE);
> > >     valueNode->setValue("Test Password");
> > > 
> > >     childNode->addChild(valueNode);
> > >     parentNode->addChild(childNode);
> > > 
> > >     phb->addChild(parentNode);
> > > 
> > >     and after that, I can call service.
> > >     But - how do I read these fields? How to find out how the service
> > >     changed these fields?
> > > 
> > > 
> > 
> > 
> > 
> > 		
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! Mail - Helps protect you from nasty viruses.
> > http://promotions.yahoo.com/new_mail
> > 
> 
> 


Re: SOAPHeader and c++ client help needed

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

>how do I read these fields?

If what you mean by read these fields is to read and manipulate them,
then you will have to configure some server side Handlers inorder to do
this. Have a look at the server side handler example at Axis C++. (at
samples/server/echoStringHeaderHandler). The mecanism to manupulate with
the SOAPHeaders in Axis C++ is through Handlers. (Have a look at the
user guide Handlers seciton also)

Roshan

On Fri, 2004-07-09 at 08:37, Samisa Abeysinghe wrote:
> You could use the tcpmon (java org.apache.axis.utils.tcpmon) that comes with Axis Java to trace
> the request and response.
> Unfortunately, there is no SOAP message level trace utility built into C++.
> 
> Samisa...
> 
> --- Sergej Srepfler <se...@jware.hr> wrote:
> > I am totally lost here.
> > 
> > I did find an example how to set an SOAPHeader from C++ client.
> >    /*create a header of the form:
> >        <SOAP-ENV:Header>
> >        <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
> >        <TestAuthHeader>
> >        <username>Test User</username>
> >        <password>Test Password</password>
> >        </TestAuthHeader>
> >        </th:newName>
> >        </SOAP-ENV:Header>
> >      */
> > 
> > 
> >     //set SOAP headers
> >     IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader",
> >                 "http://ws.apache.org/axisCppTest/");
> > 
> >     //create parent node
> >     BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
> >     parentNode->setLocalName("Credentials");
> >     //create child node     
> >     BasicNode *childNode = phb->createChild(ELEMENT_NODE);
> >     childNode->setLocalName("username");
> >     //create char node for value
> >     BasicNode *valueNode = phb->createChild(CHARACTER_NODE);
> >     valueNode->setValue("Test User");
> >     //buld node tree
> >     childNode->addChild(valueNode);
> >     parentNode->addChild(childNode);
> > 
> >    //add another node set
> >     childNode = phb->createChild(ELEMENT_NODE);
> >     childNode->setLocalName("password");
> > 
> >     valueNode = phb->createChild(CHARACTER_NODE);
> >     valueNode->setValue("Test Password");
> > 
> >     childNode->addChild(valueNode);
> >     parentNode->addChild(childNode);
> > 
> >     phb->addChild(parentNode);
> > 
> >     and after that, I can call service.
> >     But - how do I read these fields? How to find out how the service
> >     changed these fields?
> > 
> > 
> 
> 
> 
> 		
> __________________________________
> Do you Yahoo!?
> Yahoo! Mail - Helps protect you from nasty viruses.
> http://promotions.yahoo.com/new_mail
> 


Re: SOAPHeader and c++ client help needed

Posted by Samisa Abeysinghe <sa...@yahoo.com>.
You could use the tcpmon (java org.apache.axis.utils.tcpmon) that comes with Axis Java to trace
the request and response.
Unfortunately, there is no SOAP message level trace utility built into C++.

Samisa...

--- Sergej Srepfler <se...@jware.hr> wrote:
> I am totally lost here.
> 
> I did find an example how to set an SOAPHeader from C++ client.
>    /*create a header of the form:
>        <SOAP-ENV:Header>
>        <th:newName xmlns:th="http://ws.apache.org/axisCppTest/">
>        <TestAuthHeader>
>        <username>Test User</username>
>        <password>Test Password</password>
>        </TestAuthHeader>
>        </th:newName>
>        </SOAP-ENV:Header>
>      */
> 
> 
>     //set SOAP headers
>     IHeaderBlock *phb = ws.createSOAPHeaderBlock("TestHeader",
>                 "http://ws.apache.org/axisCppTest/");
> 
>     //create parent node
>     BasicNode *parentNode = phb->createChild(ELEMENT_NODE);
>     parentNode->setLocalName("Credentials");
>     //create child node     
>     BasicNode *childNode = phb->createChild(ELEMENT_NODE);
>     childNode->setLocalName("username");
>     //create char node for value
>     BasicNode *valueNode = phb->createChild(CHARACTER_NODE);
>     valueNode->setValue("Test User");
>     //buld node tree
>     childNode->addChild(valueNode);
>     parentNode->addChild(childNode);
> 
>    //add another node set
>     childNode = phb->createChild(ELEMENT_NODE);
>     childNode->setLocalName("password");
> 
>     valueNode = phb->createChild(CHARACTER_NODE);
>     valueNode->setValue("Test Password");
> 
>     childNode->addChild(valueNode);
>     parentNode->addChild(childNode);
> 
>     phb->addChild(parentNode);
> 
>     and after that, I can call service.
>     But - how do I read these fields? How to find out how the service
>     changed these fields?
> 
> 



		
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail