Qore SoapClient Module Reference
0.2.5
|
SOAP client class implementation, publically inherits qore's HTTPClient class. More...
Inherits HTTPClient.
Public Member Functions | |
constructor (hash h) | |
creates the object based on a WSDL which is parsed to a WebService object which provides the basis for all communication with this object More... | |
hash | getMsg (string operation, any args, *hash header, reference op, *hash nsh, *int xml_opts, *string soapaction) |
returns a hash representing the serialized SOAP request for a given WSOperation More... | |
any | callOperation (string operation, any args, *hash opts, *reference info) |
makes a server call with the given operation, arguments, options, and optional info hash reference and returns the result More... | |
any | call (string operation, any args, *hash header, *hash nsh, *string binding) |
makes a server call with the given operation and arguments and returns the deserialized result More... | |
any | call (string operation, any args, *reference info, *string binding) |
makes a server call with the given operation and arguments and returns the deserialized result More... | |
any | call (reference info, string operation, any args, *hash header, *hash nsh) |
makes a server call with the given operation and arguments and returns the deserialized result with an output argument giving technical information about the call More... | |
any | methodGate (string op) |
uses SoapClient::call() to transparently serialize the argument and make a call to the given operation and return the deserialized results More... | |
hash | getType (string type, any v) |
returns a hash that can be used to ensure serialization with the XSD type given as the type argument | |
WSDL::WebService | getWebService () |
returns the WSDL::WebService object associated with this object | |
hash | getInfo () |
returns a hash of information about the current WSDL More... | |
setSendEncoding (string enc="auto") | |
change the data content encoding (compression) option for the object; see EncodingSupport for valid options More... | |
setContentEncoding (string enc="auto") | |
sets the request and desired response encoding for the object; see EncodingSupport for valid options More... | |
addDefaultHeaders (hash h) | |
adds default headers to each request; these headers will be sent in all requests but can be overridden in requests as well More... | |
hash | getDefaultHeaders () |
returns the hash of default headers to sent in all requests More... | |
*string | getSendEncoding () |
returns the current data content encoding (compression) object or nothing if no encoding option is set; see EncodingSupport for valid options More... | |
log (string msg) | |
sends a log message to the log closure or call reference, if any | |
dbglog (string msg) | |
sends a log message to the debug log closure or call reference, if any | |
Public Attributes | |
const | Version = "0.2.5" |
version of the implementation of this class | |
const | Headers = ("User-Agent": ("Qore-Soap-Client/" + SoapClient::Version)) |
default HTTP headers | |
const | HTTPOptions = ("connect_timeout", "http_version", "max_redirects", "proxy", "timeout") |
option keys passed to the HTTPClient constructor | |
string | url |
target URL | |
hash | headers = Headers |
HTTP headers to use. | |
const | EncodingSupport |
Send content encoding options. More... | |
const | CompressionThreshold = 1024 |
default threadhold for data compressions; transfers smaller than this size will not be compressed | |
private | |
makes the call to the SOAP server and ensures that SOAP fault responses returned with a 500-series status code are processed as a SOAP fault so that error information is returned in the resulting exception | |
Private Member Functions | |
nothing | msglog (hash msg) |
SOAP client class implementation, publically inherits qore's HTTPClient class.
SoapClient::SoapClient::addDefaultHeaders | ( | hash | h | ) |
adds default headers to each request; these headers will be sent in all requests but can be overridden in requests as well
h | a hash of headers to add to the default headers to send on each request |
any SoapClient::SoapClient::call | ( | string | operation, |
any | args, | ||
*hash | header, | ||
*hash | nsh, | ||
*string | binding | ||
) |
makes a server call with the given operation and arguments and returns the deserialized result
operation | the operation name for the SOAP call |
args | the arguments to the SOAP operation |
header | optional soap headers (if required by the operation) |
nsh | a hash giving HTTP header information to include in the message (does not override automatically-generated SOAP message headers) |
binding | the SOAP binding name, if not provided, the first binding assigned to the operation will be used |
WSDL-OPERATION-ERROR | the operation is not defined in the WSDL |
WSDL-BINDING-ERROR | the binding is not assigned to a SOAP operation in the WSDL |
HTTP-CLIENT-RECEIVE-ERROR | this exception is thrown when the SOAP server returns an HTTP error code; if a SOAP fault is returned, then it is deserialized and returned in the arg key of the exception hash |
any SoapClient::SoapClient::call | ( | string | operation, |
any | args, | ||
*reference | info, | ||
*string | binding | ||
) |
makes a server call with the given operation and arguments and returns the deserialized result
operation | the operation name for the SOAP call |
args | the arguments to the SOAP operation |
info | an optional reference to return a hash of technical information about the SOAP call (raw message info and headers); the following keys are present in this hash:
|
binding | the SOAP binding name, if not provided, the first binding assigned to the operation will be used |
WSDL-OPERATION-ERROR | the operation is not defined in the WSDL |
WSDL-BINDING-ERROR | the binding is not assigned to a SOAP operation in the WSDL |
HTTP-CLIENT-RECEIVE-ERROR | this exception is thrown when the SOAP server returns an HTTP error code; if a SOAP fault is returned, then it is deserialized and returned in the arg key of the exception hash |
any SoapClient::SoapClient::call | ( | reference | info, |
string | operation, | ||
any | args, | ||
*hash | header, | ||
*hash | nsh | ||
) |
makes a server call with the given operation and arguments and returns the deserialized result with an output argument giving technical information about the call
info | an optional reference to return a hash of technical information about the SOAP call (raw message info and headers); the following keys are present in this hash:
|
operation | the operation name for the SOAP call |
args | the arguments to the SOAP operation |
opts | an optional hash of options for the call as follows:
|
WSDL-OPERATION-ERROR | the operation is not defined in the WSDL |
WSDL-BINDING-ERROR | the binding is not assigned to a SOAP operation in the WSDL |
HTTP-CLIENT-RECEIVE-ERROR | this exception is thrown when the SOAP server returns an HTTP error code; if a SOAP fault is returned, then it is deserialized and returned in the arg key of the exception hash |
any SoapClient::SoapClient::callOperation | ( | string | operation, |
any | args, | ||
*hash | opts, | ||
*reference | info | ||
) |
makes a server call with the given operation, arguments, options, and optional info hash reference and returns the result
operation | the SOAP operation to use to serialize the request; if the operation is not known to the underlying WebService class, an exception will be thrown |
args | the arguments to the SOAP operation |
opts | an optional hash of options for the call as follows:
|
info | an optional reference to return a hash of technical information about the SOAP call (raw message info and headers); the following keys are present in this hash:
|
hdr:
a hash of message headersbody:
the serialized message bodyWSDL-OPERATION-ERROR | the operation is not defined in the WSDL |
WSDL-BINDING-ERROR | the binding is not assigned to a SOAP operation in the WSDL |
HTTP-CLIENT-RECEIVE-ERROR | this exception is thrown when the SOAP server returns an HTTP error code; if a SOAP fault is returned, then it is deserialized and returned in the arg key of the exception hash |
SoapClient::SoapClient::constructor | ( | hash | h | ) |
creates the object based on a WSDL which is parsed to a WebService object which provides the basis for all communication with this object
one of either the wsdl
or wsdl_file
keys is required in the hash given to the constructor or an exception will be thrown
h | valid option keys:
|
hash SoapClient::SoapClient::getDefaultHeaders | ( | ) |
returns the hash of default headers to sent in all requests
hash SoapClient::SoapClient::getInfo | ( | ) |
returns a hash of information about the current WSDL
"service"
: the name of the SOAP service used"pore"
: the name of the SOAP port used"binding"
: the name of the binding used"url"
: the target URL hash SoapClient::SoapClient::getMsg | ( | string | operation, |
any | args, | ||
*hash | header, | ||
reference | op, | ||
*hash | nsh, | ||
*int | xml_opts, | ||
*string | soapaction | ||
) |
returns a hash representing the serialized SOAP request for a given WSOperation
operation | the SOAP operation to use to serialize the request; if the operation is not known to the underlying WebService class and port/binding, an exception will be thrown |
args | the arguments to the SOAP operation |
header | data structure for the SOAP header, if required by the message |
op | a reference to return the WSOperation object found |
nsh | a hash giving HTTP header information to include in the message (does not override automatically-generated SOAP message headers) |
xml_opts | an integer XML generation option code; see XML Generation Constants for possible values; combine multiple codes with binary or ( |) |
soapaction | an optional string that will override the SOAPAction for the request; en empty string here will prevent the SOAPAction from being sent |
hdr:
a hash of message headersbody:
the serialized message bodypath:
the path part of URLmethod:
the HTTP request methodWSDL-OPERATION-ERROR | the operation is not defined in the WSDL |
WSDL-BINDING-ERROR | the binding is not assigned to a SOAP operation in the WSDL |
*string SoapClient::SoapClient::getSendEncoding | ( | ) |
returns the current data content encoding (compression) object or nothing if no encoding option is set; see EncodingSupport for valid options
any SoapClient::SoapClient::methodGate | ( | string | op | ) |
uses SoapClient::call() to transparently serialize the argument and make a call to the given operation and return the deserialized results
op | the operation name, which is the method name passed to methodGate() |
... | zero or more arguments for the operation |
WSDL-OPERATION-ERROR | the operation is not defined in the WSDL |
HTTP-CLIENT-RECEIVE-ERROR | this exception is thrown when the SOAP server returns an HTTP error code; if a SOAP fault is returned, then it is deserialized and returned in the arg key of the exception hash |
|
private |
Method is to be overriden to implement custom logging HTTP message sent and received from this object.
SoapClient::SoapClient::setContentEncoding | ( | string | enc = "auto" | ) |
sets the request and desired response encoding for the object; see EncodingSupport for valid options
enc | the data content encoding (compression) option for requests and the desired response content encoding for the object; see EncodingSupport for valid options; if the value "auto" is passed then "gzip" encoding is used for outgoing requests and requested for responses |
SOAPCLIENT-ERROR | invalid or unsupported data content encoding / compression option |
SoapClient::SoapClient::setSendEncoding | ( | string | enc = "auto" | ) |
change the data content encoding (compression) option for the object; see EncodingSupport for valid options
The default is to send requests unencoded/uncompressed.
enc | the data content encoding (compression) option for the object; see EncodingSupport for valid options; if the value "auto" is passed then "gzip" encoding is used |
SOAPCLIENT-ERROR | invalid or unsupported data content encoding / compression option |
const SoapClient::SoapClient::EncodingSupport |
Send content encoding options.
Send content encoding options are as follows:
"bzip"
: use bzip2 compression"gzip"
: use gzip compression"deflate"
: use deflate compression"identity"
: use no content encoding