xsdata.formats.dataclass.client module¶
-
class
xsdata.formats.dataclass.client.Config(style, location, transport, soap_action, input, output)[source]¶ Bases:
objectService configuration class.
- Parameters
-
input: Type¶
-
output: Type¶
-
class
xsdata.formats.dataclass.client.TransportTypes[source]¶ Bases:
object-
SOAP= 'http://schemas.xmlsoap.org/soap/http'¶
-
-
class
xsdata.formats.dataclass.client.Client(config, transport=<factory>, parser=<factory>, serializer=<factory>)[source]¶ Bases:
object- Parameters
config (
Config) – service configurationtransport (
Transport) – transport instance to handle requestsparser (
XmlParser) – xml parser instance to handle xml response parsingserializer (
XmlSerializer) – xml serializer instance to handle xml response parsing
-
dict_converter: xsdata.formats.dataclass.parsers.json.DictConverter¶
-
send(obj, headers=None)[source]¶ Send a request and parse the response according to the service configuration.
The input object can be a dictionary, or the input type instance directly
>>> params = {"body": {"add": {"int_a": 3, "int_b": 4}}} >>> res = client.send(params)
Is equivalent with:
>>> req = CalculatorSoapAddInput( >>> body=CalculatorSoapAddInput.Body(add=Add(3, 4))) >>> res = client.send(req)
-
prepare_headers(headers)[source]¶ Prepare request headers according to the service configuration.
Don’t mutate input headers dictionary.
- Raises
ClientValueError – If the service transport type is unsupported.
- Parameters
headers (
Dict) –- Return type
-
prepare_payload(obj)[source]¶ Prepare and serialize payload to be sent.
- Raises
ClientValueError – If the config input type doesn’t match the given input.
- Parameters
obj (
Any) –- Return type