WsdlPull::WsdlInvoker Class Reference

#include <WsdlInvoker.h>

Collaboration diagram for WsdlPull::WsdlInvoker:

Collaboration graph
[legend]

List of all members.

Public Member Functions

void setLocation (const std::string &url)
void setCredentials (const std::string &user, const std::string &pass)
void setAuth (const std::string &user, const std::string &pass)
std::string getSoapMessage ()
std::string getXMLResponse ()
void setProxy (const std::string &host, int port=80)
void setVerbose (bool f)
void printTypeNames (bool f)
std::string errors ()
bool status () const
std::string getFaultCode () const
std::string getFaultSubCode () const
std::string getFaultString () const
std::string getFaultActor () const
Constructors and Destructors


 WsdlInvoker (const std::string &url, const std::string &schemaPath="")
 WsdlInvoker (std::istream &input, const std::string &schemaPath="")
 WsdlInvoker ()
 ~WsdlInvoker ()
WSDL Inspection


bool setWSDLUri (const std::string &url, const std::string &schemaPath="")
int getOperations (std::vector< std::string > &operations)
 return names of operations (only for the SOAP binding portType)
std::string getOpDocumentation (const std::string &n)
std::string getDocumentation ()
bool setOperation (const std::string &operation, WsdlPull::MessageType mType=WsdlPull::Input)
 set the operation to invoke
std::string getServiceEndPoint (const std::string &opname)
Simple Invocation usage


bool setValue (const std::string &param, void *val)
 sets the param value for an operation by name of the parameter
bool setValue (const std::string &param, void **values, unsigned int occur)
bool setValue (const std::string &param, std::string val)
bool setValue (const std::string &param, std::vector< std::string > values)
bool setValue (const std::vector< std::string > &parents, void *val)
bool invoke (long timeout=0, bool processResponse=true)
void * getValue (const std::string &param, Schema::Type &t)
template<typename T>
getValue (const std::string &xpath)
template<typename T>
std::vector< T > getValues (const std::string &xpath)
A more complex but powerful usage


int getNextInput (std::string &param, Schema::Type &type, int &minimum, int &maximum)
int getNextInput (std::string &param, Schema::Type &type, int &minimum, int &maximum, std::vector< std::string > &parents)
int getNextHeaderInput (std::string &param, Schema::Type &type, int &minimum, int &maximum)
int getNextHeaderInput (std::string &param, Schema::Type &type, int &minimum, int &maximum, std::vector< std::string > &parents)
int nInputHeaders () const
bool setInputValue (const int param, void *val)
bool setInputValue (const int id, void **values, unsigned int occur)
bool setInputValue (const int param, std::string val)
bool setInputValue (const int param, std::vector< std::string > values)
bool getNextOutput (std::string &name, TypeContainer *&tc)
TypeContainergetOutput (const std::string &name)
bool getNextHeaderOutput (std::string &name, TypeContainer *&tc)


Detailed Description

Definition at line 48 of file WsdlInvoker.h.


Constructor & Destructor Documentation

WsdlPull::WsdlInvoker::WsdlInvoker ( const std::string &  url,
const std::string &  schemaPath = "" 
)

The default constructor for WsdlInvoker

Parameters:
wsdl url
stream for logging errors

Definition at line 117 of file WsdlInvoker.cpp.

WsdlPull::WsdlInvoker::WsdlInvoker ( std::istream &  input,
const std::string &  schemaPath = "" 
)

WsdlPull::WsdlInvoker::WsdlInvoker (  ) 

Definition at line 40 of file WsdlInvoker.cpp.

WsdlPull::WsdlInvoker::~WsdlInvoker (  ) 

Definition at line 1228 of file WsdlInvoker.cpp.


Member Function Documentation

bool WsdlPull::WsdlInvoker::setWSDLUri ( const std::string &  url,
const std::string &  schemaPath = "" 
) [inline]

setWSDLUri set the url of the wsdl file to be processed

Parameters:
url for the wsdl file
optional path to schema files required to parse wsdl extensions (soap,http)

Definition at line 363 of file WsdlInvoker.h.

Referenced by main().

int WsdlPull::WsdlInvoker::getOperations ( std::vector< std::string > &  operations  ) 

return names of operations (only for the SOAP binding portType)

getOperations

Parameters:
reference to vector<string>
Returns:
int ,number of operations

Definition at line 239 of file WsdlInvoker.cpp.

Referenced by main().

std::string WsdlPull::WsdlInvoker::getOpDocumentation ( const std::string &  n  ) 

Definition at line 262 of file WsdlInvoker.cpp.

Referenced by main().

std::string WsdlPull::WsdlInvoker::getDocumentation (  ) 

Definition at line 254 of file WsdlInvoker.cpp.

References WsdlPull::WsdlParser::getDocumentation().

bool WsdlPull::WsdlInvoker::setOperation ( const std::string &  operation,
WsdlPull::MessageType  mType = WsdlPull::Input 
)

set the operation to invoke

setOperation

Parameters:
operation name to invoke
Returns:
bool ,true if successful

Definition at line 276 of file WsdlInvoker.cpp.

Referenced by main().

std::string WsdlPull::WsdlInvoker::getServiceEndPoint ( const std::string &  opname  ) 

getServiceEndPoint returns the url to be invoked for the operation

Definition at line 305 of file WsdlInvoker.cpp.

bool WsdlPull::WsdlInvoker::setValue ( const std::string &  param,
void *  val 
)

sets the param value for an operation by name of the parameter

setValue

Parameters:
name of the operation's parameter
string/void* representation of the parameter
Returns:
true if successful,false if the values didnt match or occurrence constraint failed example invoker.setInputValue("symbol","ABC") or int zip = 94018; invoker.setInputValue("zip",(void*)(&zip)); Note that "symbol" or "zip" above can be a message part or a constituent particle in a complex type The API takes care of it.

Definition at line 915 of file WsdlInvoker.cpp.

References setInputValue().

bool WsdlPull::WsdlInvoker::setValue ( const std::string &  param,
void **  values,
unsigned int  occur 
)

Definition at line 926 of file WsdlInvoker.cpp.

References setInputValue().

bool WsdlPull::WsdlInvoker::setValue ( const std::string &  param,
std::string  val 
)

Definition at line 938 of file WsdlInvoker.cpp.

References setInputValue().

bool WsdlPull::WsdlInvoker::setValue ( const std::string &  param,
std::vector< std::string >  values 
)

Definition at line 949 of file WsdlInvoker.cpp.

References setInputValue().

bool WsdlPull::WsdlInvoker::setValue ( const std::vector< std::string > &  parents,
void *  val 
)

bool WsdlPull::WsdlInvoker::invoke ( long  timeout = 0,
bool  processResponse = true 
)

void * WsdlPull::WsdlInvoker::getValue ( const std::string &  param,
Schema::Type t 
)

getValue return the value of the output whose name is 'param'

Parameters:
type is set by reference to enable type casting in client code
Returns:
pointer to the value or 0 if there is no simple type or part name whose name is 'param' in the web service output. example float * val = (int*) invoker.getOutput("Result",t);//stock quotes t would be Schema::FLOAT

Definition at line 1309 of file WsdlInvoker.cpp.

template<typename T>
T WsdlPull::WsdlInvoker::getValue ( const std::string &  xpath  )  [inline]

getValue return the value based on an xpath like expression

Parameters:
xpath - the xpath expression or an element name which leads to a simple type element or attribute if it points to a simple type element,the element's text is returned, if it points to the attribute the attribute is returned
/login/result/header/errorCode -> will do an absolute from the root node result/header/errorCode -> will do a relative match starting with "result" result//errorCode -> will return all "errorCode" under "result" //errorCode will return all "errorCode" from the root node result/ -> will return attribute value of type for element result

Returns:
- The value , an empty string is returned if the xpath expression doesnt lead to some CDATA Exception is thrown if this method is called when the status() returns false or web service response is empty example float getValue<float>('StockQuoteResponse/quote')

Definition at line 428 of file WsdlInvoker.h.

template<typename T>
std::vector< T > WsdlPull::WsdlInvoker::getValues ( const std::string &  xpath  )  [inline]

Definition at line 449 of file WsdlInvoker.h.

Referenced by main().

int WsdlPull::WsdlInvoker::getNextInput ( std::string &  param,
Schema::Type type,
int &  minimum,
int &  maximum 
)

getNextInput Calling this method repeatedly informs the caller of the input types the web service operation expects. Each call returns a unique id which must be used while setting the value using setInputValue.This method exposes only atomic types.Even if a web service needs a complex type,the api exposes only the constituent particles.The only exception is when a complex content model needs multiple occurrences which is still a TODO

Parameters:
ref:param name Name of the param
ref:Schema::Type,the schema type
ref,: minimum and maximum (occurrences)
ref:parents,parent list of type hierarchy for this parameter.
Returns:
unique id of this parameter

Definition at line 1096 of file WsdlInvoker.cpp.

Referenced by main().

int WsdlPull::WsdlInvoker::getNextInput ( std::string &  param,
Schema::Type type,
int &  minimum,
int &  maximum,
std::vector< std::string > &  parents 
)

Definition at line 1103 of file WsdlInvoker.cpp.

int WsdlPull::WsdlInvoker::getNextHeaderInput ( std::string &  param,
Schema::Type type,
int &  minimum,
int &  maximum 
)

getNextHeaderInput Similar to the previous method except that it gets the SOAP headers if any Set methods are same as for regular inputs

Definition at line 1121 of file WsdlInvoker.cpp.

Referenced by main().

int WsdlPull::WsdlInvoker::getNextHeaderInput ( std::string &  param,
Schema::Type type,
int &  minimum,
int &  maximum,
std::vector< std::string > &  parents 
)

Definition at line 1130 of file WsdlInvoker.cpp.

int WsdlPull::WsdlInvoker::nInputHeaders (  )  const [inline]

returns the number of input headers you may need to set

Definition at line 392 of file WsdlInvoker.h.

Referenced by main().

bool WsdlPull::WsdlInvoker::setInputValue ( const int  param,
void *  val 
)

setInputValue sets the param value for an operation only simple types can be set.

Parameters:
id return by getNextInput()
void ** pointer to array of pointers to the the values
Returns:
true if successful,false if the values didnt match or occurrence constraint failed

Definition at line 881 of file WsdlInvoker.cpp.

References Schema::XSDType::getContentModel(), Schema::ComplexType::getContentType(), Schema::SchemaParser::getType(), Schema::XSDType::isSimple(), Schema::TypeContainer::isValueValid(), Schema::TypeContainer::print(), Schema::Simple, and Schema::SchemaValidator::validate().

Referenced by main(), and setValue().

bool WsdlPull::WsdlInvoker::setInputValue ( const int  id,
void **  values,
unsigned int  occur 
)

bool WsdlPull::WsdlInvoker::setInputValue ( const int  param,
std::string  val 
)

setInputValue sets the param value for an operation only simple types can be set.

Parameters:
id return by getNextInput()
string representation of the parameter
Returns:
true if successful,false if the values didnt match or occurrence constraint failed

Definition at line 844 of file WsdlInvoker.cpp.

References Schema::XSDType::getContentModel(), Schema::ComplexType::getContentType(), Schema::SchemaParser::getType(), Schema::XSDType::isSimple(), Schema::TypeContainer::isValueValid(), Schema::Simple, and Schema::SchemaValidator::validate().

bool WsdlPull::WsdlInvoker::setInputValue ( const int  param,
std::vector< std::string >  values 
)

bool WsdlPull::WsdlInvoker::getNextOutput ( std::string &  name,
TypeContainer *&  tc 
)

getNextOutput get the part/elem name and type container

Returns:
false when we finished iterating through all outputs after which it rewinds and you can start again

Definition at line 1267 of file WsdlInvoker.cpp.

Referenced by main().

TypeContainer * WsdlPull::WsdlInvoker::getOutput ( const std::string &  name  ) 

getOutput return the type container which stores the output for the output part/elem name

Definition at line 1282 of file WsdlInvoker.cpp.

bool WsdlPull::WsdlInvoker::getNextHeaderOutput ( std::string &  name,
TypeContainer *&  tc 
)

getNextHeaderOutput get the type container which stores the SOAP header

Returns:
false when we finished iterating through all outputs after which it rewinds and you can start again

Definition at line 1293 of file WsdlInvoker.cpp.

Referenced by main().

void WsdlPull::WsdlInvoker::setLocation ( const std::string &  url  )  [inline]

Definition at line 378 of file WsdlInvoker.h.

void WsdlPull::WsdlInvoker::setCredentials ( const std::string &  user,
const std::string &  pass 
)

void WsdlPull::WsdlInvoker::setAuth ( const std::string &  user,
const std::string &  pass 
)

Definition at line 1871 of file WsdlInvoker.cpp.

std::string WsdlPull::WsdlInvoker::getSoapMessage (  ) 

Definition at line 961 of file WsdlInvoker.cpp.

References invoke().

Referenced by main().

std::string WsdlPull::WsdlInvoker::getXMLResponse (  ) 

Definition at line 970 of file WsdlInvoker.cpp.

void WsdlPull::WsdlInvoker::setProxy ( const std::string &  host,
int  port = 80 
)

Definition at line 1879 of file WsdlInvoker.cpp.

References XmlUtils::setProxy(), and XmlUtils::setProxyHost().

void WsdlPull::WsdlInvoker::setVerbose ( bool  f  )  [inline]

Definition at line 385 of file WsdlInvoker.h.

Referenced by main().

void WsdlPull::WsdlInvoker::printTypeNames ( bool  f  ) 

Definition at line 1619 of file WsdlInvoker.cpp.

Referenced by main().

std::string WsdlPull::WsdlInvoker::errors (  )  [inline]

Definition at line 356 of file WsdlInvoker.h.

Referenced by main().

bool WsdlPull::WsdlInvoker::status (  )  const [inline]

Definition at line 371 of file WsdlInvoker.h.

Referenced by main().

std::string WsdlPull::WsdlInvoker::getFaultCode (  )  const [inline]

Definition at line 399 of file WsdlInvoker.h.

std::string WsdlPull::WsdlInvoker::getFaultSubCode (  )  const [inline]

Definition at line 406 of file WsdlInvoker.h.

std::string WsdlPull::WsdlInvoker::getFaultString (  )  const [inline]

Definition at line 413 of file WsdlInvoker.h.

std::string WsdlPull::WsdlInvoker::getFaultActor (  )  const [inline]

Definition at line 420 of file WsdlInvoker.h.


The documentation for this class was generated from the following files:

Generated on Sat Jan 10 19:07:20 2009 for wsdlpull by  doxygen 1.5.5