Go to the documentation of this file.
30 #define PACKAGE_VERSION "1.x"
36 std::cout<<
"Usage wsdl [options] wsdl-uri [operation name] [method parameters] [xpath expression for response]"<<std::endl;
37 std::cout<<
"Version "<<PACKAGE_VERSION<<std::endl;
38 std::cout<<
"Options: "<<std::endl;
39 std::cout<<
" -h Display this message"<<std::endl;
40 std::cout<<
" -x host[:port] Use HTTP proxy on given port"<<std::endl;
41 std::cout<<
" -U user[:password] Specify Proxy authentication"<<std::endl;
42 std::cout<<
" -v Verbose mode,SOAP request and response are logged"<<std::endl;
43 std::cout<<
" -d display WSDL operation's documentation"<<std::endl;
44 std::cout<<
" -p display WSDL port types and their operations"<<std::endl;
45 std::cout<<
" -l list all the WSDL operations "<<std::endl;
46 std::cout<<
" -o Allow setting occurrence constraint (default is 1)"<<std::endl;
47 std::cout<<
" -s Suppress printing type/element names in the output"<<std::endl;
48 std::cout<<
" -t requesttimeout in seconds"<<std::endl;
49 std::cout<<
" -e set SOAP headers in input"<<std::endl;
50 std::cout<<
" -g generate sample SOAP message for the invocation"<<std::endl;
51 std::cout<<
" -r Validate the response message with schema even when xpath selector is used(default is off)"<<std::endl;
52 std::cout<<
"With no arguments,wsdl starts in the interactive mode accepting operation name and parameters from the standard input."<<std::endl<<std::endl;
53 std::cout<<
"An xpath expression can be used to extract elements from web service response.If the expression points to an element or an attribute,the element's text or attribute value will be returned.The expression will match all occurrences in the xml tree"<<std::endl;
69 cout <<
"Port Type :" << p->
getName () <<
" has " <<
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]);
137 else if (opt ==
"s"){
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;
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){
259 std::cerr<<
"Unkown operation name "<<argv[i]<<std::endl;
266 std::vector<std::string> ops;
267 unsigned int choice = 0;
270 for (
size_t s = 0;s<ops.size();s++){
272 std::cout<<s+1<<
"."<<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;
303 std::cerr<<
"Couldn't invoke operation "<<std::endl<<invoker.
errors()<<std::endl;
309 std::cout<<
"Warning:This operation has some SOAP headers in its inputs!(use -e)"<<std::endl;
314 int id =0,minimum,maximum,n;
318 std::vector<std::string> values;
319 std::vector<std::string> 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);
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]<<
": ";
382 std::cerr<<
"Incorrect input value "<<val<<std::endl;
389 if (generateSoapMsg) {
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;
433 tc->
print(std::cout);
434 std::cout<<std::endl;
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;
void printTypeNames(bool f)
bool printPortTypes(std::string uri)
std::string getOpDocumentation(const std::string &n)
std::list< const Message * > MessageList
void WSDLPULL_EXPORT setProxy(const bool bProxy)
bool setWSDLUri(const std::string &url, const std::string &schemaPath="")
bool setInputValue(const int param, void *val)
void print(std::ostream &os)
const PortType * getPortType()
bool getNextOutput(std::string &name, TypeContainer *&tc)
int getNextHeaderInput(std::string ¶m, Schema::Type &type, int &minimum, int &maximum)
std::string getName() const
bool invoke(long timeout=0, bool processResponse=true)
int getNumOps(void) const
int getNextInput(std::string ¶m, Schema::Type &type, int &minimum, int &maximum)
void WSDLPULL_EXPORT setProxyUser(const std::string &sProxyUser)
std::string WSDLPULL_EXPORT getProxyHost()
int main(int argc, char *argv[])
bool setOperation(const std::string &operation, WsdlPull::MessageType mType=WsdlPull::Input)
set the operation to invoke
bool WSDLPULL_EXPORT getProxy()
bool getNextHeaderOutput(std::string &name, TypeContainer *&tc)
void WSDLPULL_EXPORT setProxyHost(const std::string &sProxyHost)
int getOperations(std::vector< std::string > &operations)
return names of operations (only for the SOAP binding portType)
std::string getSoapMessage()
std::vector< Operation * >::const_iterator cOpIterator
std::string WSDLPULL_EXPORT acceptSecretKey(const std::string &field)
int nInputHeaders() const
void WSDLPULL_EXPORT setProxyPass(const std::string &sProxyPass)
std::vector< T > getValues(const std::string &xpath)
sets the param value for an operation by name of the parameter
static bool useLocalSchema_
bool getOperations(Operation::cOpIterator &start, Operation::cOpIterator &finish) const