Back to index

nordugrid-arc-nox  1.1.0~rc6
test.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include <iostream>
00006 
00007 #include "WSA.h"
00008 
00009 int main(void) {
00010   std::string xml("\
00011 <S:Envelope xmlns:S=\"http://www.w3.org/2003/05/soap-envelope\"\
00012   xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">\
00013   <S:Header>\
00014     <wsa:MessageID>http://example.com/someuniquestring</wsa:MessageID>\
00015     <wsa:ReplyTo>\
00016       <wsa:Address>http://example.com/business/client1</wsa:Address>\
00017     </wsa:ReplyTo>\
00018     <wsa:From>\
00019       <wsa:Address>http://example.com/business/client1</wsa:Address>\
00020     </wsa:From>\
00021     <wsa:To>mailto:fabrikam@example.com</wsa:To>\
00022     <wsa:Action>http://example.com/fabrikam/mail/Delete</wsa:Action>\
00023     <CustomerKey wsa:IsReferenceParameter='true'>123456789</CustomerKey>\
00024     <ShoppingCart wsa:IsReferenceParameter='true'>ABCDEFG</ShoppingCart>\
00025     <wsa:FaultTo>\
00026       <wsa:Address>mailto:admin@example.com</wsa:Address>\
00027     </wsa:FaultTo>\
00028   </S:Header>\
00029   <S:Body>\
00030     <f:Delete xmlns:f=\"http://example.com/fabrikam\">\
00031        <maxCount>42</maxCount>\
00032     </f:Delete>\
00033   </S:Body>\
00034 </S:Envelope>\
00035 ");     
00036 
00037   Arc::SOAPEnvelope soap(xml);
00038   Arc::WSAHeader header(soap);
00039   std::cout<<"To: "<<header.To()<<std::endl;
00040   std::cout<<"Action: "<<header.Action()<<std::endl;
00041   std::cout<<"MessageID: "<<header.MessageID()<<std::endl;
00042   std::cout<<"RelatesTo: "<<header.RelatesTo()<<std::endl;
00043   std::cout<<"From: "<<header.From().Address()<<std::endl;
00044   std::cout<<"ReplyTo: "<<header.ReplyTo().Address()<<std::endl;
00045   std::cout<<"FaultTo: "<<header.FaultTo().Address()<<std::endl;
00046   //std::string RelationshipType(void) const;
00047   for(int i=0;;++i) {
00048     std::string s;
00049     Arc::XMLNode r = header.ReferenceParameter(i);
00050     if(!r) break;
00051     r.GetXML(s);
00052     std::cout<<"ReferenceParameter: "<<s<<std::endl;
00053   };
00054   return 0;
00055 }
00056