68 const PortType * p = wp.getPortType ();
69 cout <<
"Port Type :" << p->
getName () <<
" has " <<
70 p->getNumOps () <<
" operations "<<endl;
72 p->getOperations(from,to);
79 cout <<
" Input Message:"<<in->getName()<<endl;
81 cout <<
" Output Message:"<<out->getName()<<endl;
83 for (MessageList::iterator mli = faults->begin();
87 cout<<
" Fault :"<<(*mli)->getName()<<endl;
105 bool showDoc =
false;
106 bool verbose =
false;
108 bool listops =
false;
109 bool generateSoapMsg =
false;
110 bool accept_password =
false;
111 bool accept_headers =
false;
112 bool processResponse =
false;
121 for (;i<argc && !brkloop;){
125 std::string options(argv[i]+1);
126 char n = options.length();
129 std::string opt(1,options[n]);
132 invoker.setVerbose(
true);
137 else if (opt ==
"s"){
139 invoker.printTypeNames(
false);
142 else if (opt ==
"d"){
147 else if (opt ==
"e"){
149 accept_headers =
true;
152 else if (opt ==
"l"){
157 else if (opt ==
"x"){
159 size_t pos=opt.find(
':');
161 if(pos==std::string::npos){
169 else if (opt ==
"U"){
171 size_t pos=opt.find(
':');
173 if(pos!=std::string::npos)
176 accept_password =
true;
192 else if (opt ==
"g"){
194 generateSoapMsg =
true;
203 timeout=atoi(opt.c_str());
208 processResponse =
true;
211 std::cerr<<
"Unknown option "<<argv[i]<<std::endl;
235 if(!invoker.setWSDLUri(argv[i])) {
237 std::cerr<<
"Error processing "<<argv[i]<<std::endl;
238 std::cerr<<invoker.errors()<<std::endl;
242 std::cerr<<invoker.errors()<<std::endl;
253 std::cout<<invoker.errors()<<std::endl;
255 if (i<argc && !listops){
257 if(!invoker.setOperation(argv[i])){
259 std::cerr<<
"Unkown operation name "<<argv[i]<<std::endl;
266 std::vector<std::string> ops;
267 unsigned int choice = 0;
268 if (invoker.getOperations(ops)){
270 for (
size_t s = 0;s<ops.size();s++){
272 std::cout<<s+1<<
"."<<ops[s];
276 std::string doc = invoker.getOpDocumentation(ops[s]);
278 std::cout<<
"("<<doc<<
")";
282 if (listops ==
true){
288 std::cout<<
"Choose one of the above operations [1-"<<ops.size()<<
"] :";
290 if (choice>0 && choice<=ops.size())
298 std::cerr<<
"No operation found or missing <binding> section"<<std::endl;
301 if (!invoker.setOperation(ops[choice-1])){
303 std::cerr<<
"Couldn't invoke operation "<<std::endl<<invoker.errors()<<std::endl;
307 if(!accept_headers && invoker.nInputHeaders()>0){
309 std::cout<<
"Warning:This operation has some SOAP headers in its inputs!(use -e)"<<std::endl;
312 if (invoker.status()){
314 int id =0,minimum,maximum,n;
318 std::vector<std::string> values;
319 std::vector<std::string> parents;
323 if (accept_headers && invoker.nInputHeaders()>0){
325 id = invoker.getNextHeaderInput(param,t,minimum,maximum,parents);
327 accept_headers=
false;
333 id = invoker.getNextInput(param,t,minimum,maximum,parents);
338 if (occurs && minimum < maximum) {
340 std::cout<<param<<
"["<<minimum<<
","<<maximum<<
"] Enter number of occurrences:";
343 if (n<minimum || n>maximum){
345 std::cerr<<
"Didnt match occurrence constraints"<<std::endl;
354 std::cout<<param<<
": ";
357 values.push_back(val);
359 if (!invoker.setInputValue(
id,values)){
361 std::cerr<<
"Incorrect input values "<<std::endl;
373 for (j=0;j<parents.size()-1;j++){
375 std::cout<<parents[j]<<
".";
377 std::cout<<parents[j]<<
": ";
380 if (!invoker.setInputValue(
id,val)){
382 std::cerr<<
"Incorrect input value "<<val<<std::endl;
389 if (generateSoapMsg) {
392 std::cout <<invoker.getSoapMessage()<<std::endl;
399 std::cerr<<
"libcurl needs to be installed to proceed with invocation"<<std::endl;
400 std::cerr<<
"Try using the -g option to just print the soap message"<<std::endl;
405 if (invoker.invoke(timeout,(i>=argc || processResponse))){
414 std::vector<std::string> arr=invoker.getValues<std::string>(argv[i++]);
415 for (
size_t s = 0;s<arr.size();s++)
416 std::cout<<arr[s]<<std::endl;
426 std::cerr<<xpe.description<<std::endl;
430 while(invoker.getNextHeaderOutput(name,tc)) {
433 tc->
print(std::cout);
434 std::cout<<std::endl;
437 while (invoker.getNextOutput(name,tc)){
439 tc->
print(std::cout);
440 std::cout<<std::endl;
445 cerr<<invoker.errors()<<std::endl;
446 cerr<<
"Run with -v option and see request.log and response.log"<<endl;