Qore xml Module 2.1.0
Loading...
Searching...
No Matches
SoapClient::SoapClient Class Reference

SOAP client class implementation, publically inherits qore's HTTPClient class. More...

#include <SoapClient.qm.dox.h>

Inherits HTTPClient.

Public Member Methods

hash< auto > getMsg (*string soapaction, *int xml_opts, *hash< auto > http_header, reference< auto > op, *hash< auto > soap_header, string operation, auto args)
 returns a hash representing the serialized SOAP request for a given WSOperation
 
auto callOperation (*reference info, *hash< auto > opts, string operation, auto args)
 makes a server call with the given operation, arguments, options, and optional info hash reference and returns the result
 
auto call (*string binding, *hash< auto > http_header, *hash< auto > soap_header, string operation, auto args)
 makes a server call with the given operation and arguments and returns the deserialized result
 
auto call (*string binding, *reference info, string operation, auto args)
 makes a server call with the given operation and arguments and returns the deserialized result
 
auto call (*hash< auto > http_header, *hash< auto > soap_header, auto args, reference info, string operation)
 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
 
auto methodGate (string op)
 uses SoapClient::call() to transparently serialize the argument and make a call to the given operation and return the deserialized results
 
hash< auto > getType (string type, auto 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< auto > getInfo ()
 returns a hash of information about the current WSDL
 
void setSendEncoding (string enc)
 change the data content encoding (compression) option for the object; see EncodingSupport for valid options
 
void setContentEncoding (string enc)
 sets the request and desired response encoding for the object; see EncodingSupport for valid options
 
void addDefaultHeaders (hash< auto > h)
 adds default headers to each request; these headers will be sent in all requests but can be overridden in requests as well
 
hash< auto > getDefaultHeaders ()
 returns the hash of default headers to sent in all requests
 
*string getSendEncoding ()
 returns the current data content encoding (compression) object or nothing if no encoding option is set; see EncodingSupport for valid options
 
void log (string msg)
 sends a log message to the log closure or call reference, if any
 
void dbglog (string msg)
 sends a log message to the debug log closure or call reference, if any
 

Public Attributes

const Version = ...
 version of the implementation of this class
 
const Headers = ...
 default HTTP headers
 
const HTTPOptions = ...
 option keys passed to the HTTPClient constructor
 

Detailed Description

SOAP client class implementation, publically inherits qore's HTTPClient class.

Member Function Documentation

◆ addDefaultHeaders()

void SoapClient::SoapClient::addDefaultHeaders ( hash< auto >  h)

adds default headers to each request; these headers will be sent in all requests but can be overridden in requests as well

Example:
# disable gzip and bzip encoding in responses
soap.addDefaultHeaders(("Accept-Encoding": "compress"));
Parameters
ha hash of headers to add to the default headers to send on each request
Note
default headers can also be set in the constructor
See also
SoapClient::getDefaultHeaders()
Since
SoapClient 0.2.4

◆ call() [1/3]

auto SoapClient::SoapClient::call ( *hash< auto >  http_header,
*hash< auto >  soap_header,
auto  args,
reference  info,
string  operation 
)

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

Parameters
infoan 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:
  • "headers": a hash of HTTP request headers
  • "request-uri": the request URI string (ex: "POST /services/Soap/c/29.0 HTTP/1.1")
  • "response-uri": the response URI string (ex: "HTTP/1.1 200 OK")
  • "charset": the character encoding string (ex: "UTF-8")
  • "body-content-type": the Content-Type of the response without any charset declaration
  • "accept-charset": the value of any Accept-Charset header in the response
  • "response-headers": a hash of HTTP response headers
  • "response-body": the raw XML response body (in case content encoding is used, this is the decoded value)
  • "request-body": the raw XML request body
  • "request-soap-headers": an optional hash of SOAP headers used in the request (if applicable)
operationthe operation name for the SOAP call
argsthe arguments to the SOAP operation
soap_headeroptional soap headers (if required by the operation)
http_headera hash giving HTTP header information to include in the message (does not override automatically-generated SOAP message headers)
Returns
the deserialized result of the SOAP call to the SOAP server
Exceptions
WSDL-OPERATION-ERRORthe operation is not defined in the WSDL
WSDL-BINDING-ERRORthe binding is not assigned to a SOAP operation in the WSDL
HTTP-CLIENT-RECEIVE-ERRORthis 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
See also
SoapClient::callOperation()
Note
  • this method can throw any exception that HTTPClient::send() can throw as well as any XML parsing errors thrown by parse_xml()
  • it's recommended to use callOperation() instead, which was a cleaner and more extensible API

◆ call() [2/3]

auto SoapClient::SoapClient::call ( *string  binding,
*hash< auto >  http_header,
*hash< auto >  soap_header,
string  operation,
auto  args 
)

makes a server call with the given operation and arguments and returns the deserialized result

Parameters
operationthe operation name for the SOAP call
argsthe arguments to the SOAP operation
soap_headeroptional soap headers (if required by the operation)
http_headera hash giving HTTP header information to include in the message (does not override automatically-generated SOAP message headers)
bindingthe SOAP binding name, if not provided, the first binding assigned to the operation will be used
Returns
the deserialized result of the SOAP call to the SOAP server
Exceptions
WSDL-OPERATION-ERRORthe operation is not defined in the WSDL
WSDL-BINDING-ERRORthe binding is not assigned to a SOAP operation in the WSDL
HTTP-CLIENT-RECEIVE-ERRORthis 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
See also
SoapClient::callOperation()
Note
  • this method can throw any exception that HTTPClient::send() can throw as well as any XML parsing errors thrown by parse_xml()
  • it's recommended to use callOperation() instead, which was a cleaner and more extensible API

◆ call() [3/3]

auto SoapClient::SoapClient::call ( *string  binding,
*reference  info,
string  operation,
auto  args 
)

makes a server call with the given operation and arguments and returns the deserialized result

Parameters
operationthe operation name for the SOAP call
argsthe arguments to the SOAP operation
infoan 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:
  • "headers": a hash of HTTP request headers
  • "request-uri": the request URI string (ex: "POST /services/Soap/c/29.0 HTTP/1.1")
  • "response-uri": the response URI string (ex: "HTTP/1.1 200 OK")
  • "charset": the character encoding string (ex: "UTF-8")
  • "body-content-type": the Content-Type of the response without any charset declaration
  • "accept-charset": the value of any Accept-Charset header in the response
  • "response-headers": a hash of HTTP response headers
  • "response-body": the raw XML response body (in case content encoding is used, this is the decoded value)
  • "request-body": the raw XML request body
  • "request-soap-headers": an optional hash of SOAP headers used in the request (if applicable)
bindingthe SOAP binding name, if not provided, the first binding assigned to the operation will be used
Returns
the deserialized result of the SOAP call to the SOAP server
Exceptions
WSDL-OPERATION-ERRORthe operation is not defined in the WSDL
WSDL-BINDING-ERRORthe binding is not assigned to a SOAP operation in the WSDL
HTTP-CLIENT-RECEIVE-ERRORthis 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
See also
SoapClient::callOperation()
Note
  • this method can throw any exception that HTTPClient::send() can throw as well as any XML parsing errors thrown by parse_xml()
  • it's recommended to use callOperation() instead, which was a cleaner and more extensible API

◆ callOperation()

auto SoapClient::SoapClient::callOperation ( *reference  info,
*hash< auto >  opts,
string  operation,
auto  args 
)

makes a server call with the given operation, arguments, options, and optional info hash reference and returns the result

Parameters
operationthe SOAP operation to use to serialize the request; if the operation is not known to the underlying WebService class, an exception will be thrown
argsthe arguments to the SOAP operation
optsan optional hash of options for the call as follows:
  • soap_header: a hash giving SOAP header information, if required by the message
  • http_header: 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
  • binding: the SOAP binding name, if not provided the first binding assigned to the operation will be used
infoan 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:
  • "headers": a hash of HTTP request headers
  • "request-uri": the request URI string (ex: "POST /services/Soap/c/29.0 HTTP/1.1")
  • "response-uri": the response URI string (ex: "HTTP/1.1 200 OK")
  • "charset": the character encoding string (ex: "UTF-8")
  • "body-content-type": the Content-Type of the response without any charset declaration
  • "accept-charset": the value of any Accept-Charset header in the response
  • "response-headers": a hash of HTTP response headers
  • "response-body": the raw XML response body (in case content encoding is used, this is the decoded value)
  • "request-body": the raw XML request body
  • "request-soap-headers": an optional hash of SOAP headers used in the request (if applicable)
Returns
a hash with the following keys:
  • hdr: a hash of message headers
  • body: the serialized message body
Exceptions
WSDL-OPERATION-ERRORthe operation is not defined in the WSDL
WSDL-BINDING-ERRORthe binding is not assigned to a SOAP operation in the WSDL
HTTP-CLIENT-RECEIVE-ERRORthis 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
Note
this method can throw any exception that HTTPClient::send() can throw as well as any XML parsing errors thrown by parse_xml()
Since
SoapClient 0.2.4.1

◆ getDefaultHeaders()

hash< auto > SoapClient::SoapClient::getDefaultHeaders ( )

returns the hash of default headers to sent in all requests

Example:
hash<auto> h = soap.getDefaultHeaders();
Returns
the hash of default headers to sent in all requests
Note
default headers can be set in the constructor and in addDefaultHeaders()
See also
getDefaultHeaders
Since
SoapClient 0.2.4

◆ getInfo()

hash< auto > SoapClient::SoapClient::getInfo ( )

returns a hash of information about the current WSDL

Returns
a hash with the following keys:
  • "service": the name of the SOAP service used
  • "port": the name of the SOAP port used
  • "binding": the name of the binding used
  • "url": the target URL

◆ getMsg()

hash< auto > SoapClient::SoapClient::getMsg ( *string  soapaction,
*int  xml_opts,
*hash< auto >  http_header,
reference< auto >  op,
*hash< auto >  soap_header,
string  operation,
auto  args 
)

returns a hash representing the serialized SOAP request for a given WSOperation

Parameters
operationthe 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
argsthe arguments to the SOAP operation
soap_headerdata structure for the SOAP header, if required by the message
opa reference to return the WSOperation object found
http_headera hash giving HTTP header information to include in the message (does not override automatically-generated SOAP message headers)
xml_optsan integer XML generation option code; see XML Generation Constants for possible values; combine multiple codes with binary or (|)
soapactionan optional string that will override the SOAPAction for the request; en empty string here will prevent the SOAPAction from being sent
Returns
a hash with the following keys:
  • hdr: a hash of message headers
  • body: the serialized message body
  • path: the path part of URL
  • method: the HTTP request method
Exceptions
WSDL-OPERATION-ERRORthe operation is not defined in the WSDL
WSDL-BINDING-ERRORthe binding is not assigned to a SOAP operation in the WSDL
Note
content encoding is not applied here but rather internally by the call() methods

◆ getSendEncoding()

*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

Example:
*string ce = soap.getSendEncoding();
Returns
the current data content encoding (compression) object or nothing if no encoding option is set; see EncodingSupport for valid options
See also
Since
SoapClient 0.2.4

◆ methodGate()

auto 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

Parameters
opthe operation name, which is the method name passed to methodGate()
...zero or more arguments for the operation
Returns
the deserialized result of the SOAP call to the SOAP server
Exceptions
WSDL-OPERATION-ERRORthe operation is not defined in the WSDL
HTTP-CLIENT-RECEIVE-ERRORthis 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
See also
SoapClient::callOperation()
Note
this method can throw any exception that HTTPClient::send() can throw as well as any XML parsing errors thrown by parse_xml()

◆ setContentEncoding()

void SoapClient::SoapClient::setContentEncoding ( string  enc)

sets the request and desired response encoding for the object; see EncodingSupport for valid options

Example:
soap.setContentEncoding("gzip");
Parameters
encthe 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
Exceptions
SOAPCLIENT-ERRORinvalid or unsupported data content encoding / compression option
See also
Since
SoapClient 0.2.4

◆ setSendEncoding()

void SoapClient::SoapClient::setSendEncoding ( string  enc)

change the data content encoding (compression) option for the object; see EncodingSupport for valid options

Example:
sc.setSendEncoding("gzip");

The default is to send requests unencoded/uncompressed.

Parameters
encthe data content encoding (compression) option for the object; see EncodingSupport for valid options; if the value "auto" is passed then "gzip" encoding is used
Exceptions
SOAPCLIENT-ERRORinvalid or unsupported data content encoding / compression option
See also

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