Skip to content

wsdl

xsdata.models.wsdl

Documentation dataclass

WSDL Documentation model representation.

Parameters:

Name Type Description Default
elements list[object]

A list of generic any elements

array_any_element()
Source code in xsdata/models/wsdl.py
14
15
16
17
18
19
20
21
22
@dataclass
class Documentation:
    """WSDL Documentation model representation.

    Args:
        elements: A list of generic any elements
    """

    elements: list[object] = array_any_element()

WsdlElement dataclass

WSDL Base element model representation.

Parameters:

Name Type Description Default
name str

The element name

attribute()
documentation Documentation | None

The element documentation

element()
Source code in xsdata/models/wsdl.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
@dataclass
class WsdlElement:
    """WSDL Base element model representation.

    Args:
        name: The element name
        documentation: The element documentation
    """

    name: str = attribute()
    documentation: Documentation | None = element()
    location: str | None = field(default=None, metadata={"type": "Ignore"})
    ns_map: dict[str, str] = field(
        default_factory=dict, init=False, metadata={"type": "Ignore"}
    )

ExtensibleElement dataclass

Bases: WsdlElement

WSDL Extensible element model representation.

Parameters:

Name Type Description Default
name str

The element name

attribute()
documentation Documentation | None

The element documentation

element()
extended list[object]

A list of generic elements

array_any_element()
Source code in xsdata/models/wsdl.py
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
@dataclass
class ExtensibleElement(WsdlElement):
    """WSDL Extensible element model representation.

    Args:
        name: The element name
        documentation: The element documentation
        extended: A list of generic elements
    """

    extended: list[object] = array_any_element()

    @property
    def extended_elements(self) -> Iterator[AnyElement]:
        """Yields all generic element instances."""
        yield from (ext for ext in self.extended if isinstance(ext, AnyElement))

extended_elements property

Yields all generic element instances.

Types dataclass

WSDL Types model representation.

Parameters:

Name Type Description Default
schemas list[Schema]

Inline xml schema definitions

array_element(name='schema', namespace=uri)
documentation Documentation | None

The type documentation

element()
Source code in xsdata/models/wsdl.py
60
61
62
63
64
65
66
67
68
69
70
@dataclass
class Types:
    """WSDL Types model representation.

    Args:
        schemas: Inline xml schema definitions
        documentation: The type documentation
    """

    schemas: list[Schema] = array_element(name="schema", namespace=Namespace.XS.uri)
    documentation: Documentation | None = element()

Import dataclass

WSDL Import model representation.

Parameters:

Name Type Description Default
location str | None

The location URI

attribute()
namespace str | None

The namespace URI

attribute()
Source code in xsdata/models/wsdl.py
73
74
75
76
77
78
79
80
81
82
83
@dataclass
class Import:
    """WSDL Import model representation.

    Args:
        location: The location URI
        namespace: The namespace URI
    """

    location: str | None = attribute()
    namespace: str | None = attribute()

Part dataclass

Bases: WsdlElement

WSDL Part model representation.

Parameters:

Name Type Description Default
name str

The part name

attribute()
documentation Documentation | None

The part documentation

element()
type str | None

The part type

attribute()
element str | None

The part element

attribute()
Source code in xsdata/models/wsdl.py
86
87
88
89
90
91
92
93
94
95
96
97
98
@dataclass
class Part(WsdlElement):
    """WSDL Part model representation.

    Args:
        name: The part name
        documentation: The part documentation
        type: The part type
        element: The part element
    """

    type: str | None = attribute()
    element: str | None = attribute()

Message dataclass

Bases: WsdlElement

WSDL Message model representation.

Parameters:

Name Type Description Default
name str

The message name

attribute()
documentation Documentation | None

The message documentation

element()
parts list[Part]

The message parts

array_element(name='part')
Source code in xsdata/models/wsdl.py
101
102
103
104
105
106
107
108
109
110
111
@dataclass
class Message(WsdlElement):
    """WSDL Message model representation.

    Args:
        name: The message name
        documentation: The message documentation
        parts: The message parts
    """

    parts: list[Part] = array_element(name="part")

PortTypeMessage dataclass

Bases: WsdlElement

WSDL Port type message model representation.

Parameters:

Name Type Description Default
name str

The port type name

attribute()
documentation Documentation | None

The port type documentation

element()
message str

The port type message

attribute()
Source code in xsdata/models/wsdl.py
114
115
116
117
118
119
120
121
122
123
124
@dataclass
class PortTypeMessage(WsdlElement):
    """WSDL Port type message model representation.

    Args:
        name: The port type name
        documentation: The port type documentation
        message: The port type message
    """

    message: str = attribute()

PortTypeOperation dataclass

Bases: WsdlElement

WSDL Port type operation model representation.

Parameters:

Name Type Description Default
input PortTypeMessage

The input port type message instance

element()
output PortTypeMessage

The output port type message instance

element()
faults list[PortTypeMessage]

The list of error port type message instances

array_element(name='fault')
Source code in xsdata/models/wsdl.py
127
128
129
130
131
132
133
134
135
136
137
138
139
@dataclass
class PortTypeOperation(WsdlElement):
    """WSDL Port type operation model representation.

    Args:
        input: The input port type message instance
        output: The output port type message instance
        faults: The list of error port type message instances
    """

    input: PortTypeMessage = element()
    output: PortTypeMessage = element()
    faults: list[PortTypeMessage] = array_element(name="fault")

PortType dataclass

Bases: ExtensibleElement

WSDL Port type model representation.

Parameters:

Name Type Description Default
name str

The port type name

attribute()
documentation Documentation | None

The port type documentation

element()
extended list[object]

The port type extended elements

array_any_element()
operations list[PortTypeOperation]

The port type operations

array_element(name='operation')
Source code in xsdata/models/wsdl.py
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
@dataclass
class PortType(ExtensibleElement):
    """WSDL Port type model representation.

    Args:
        name: The port type name
        documentation: The port type documentation
        extended: The port type extended elements
        operations: The port type operations
    """

    operations: list[PortTypeOperation] = array_element(name="operation")

    def find_operation(self, name: str) -> PortTypeOperation:
        """Find an operation by name or raise an error."""
        return find_or_die(self.operations, name, "PortTypeOperation")

find_operation(name)

Find an operation by name or raise an error.

Source code in xsdata/models/wsdl.py
155
156
157
def find_operation(self, name: str) -> PortTypeOperation:
    """Find an operation by name or raise an error."""
    return find_or_die(self.operations, name, "PortTypeOperation")

BindingMessage dataclass

Bases: ExtensibleElement

WSDL Binding message model representation.

Parameters:

Name Type Description Default
name str

The message name

attribute()
documentation Documentation | None

The message documentation

element()
extended list[object]

The message extended elements

array_any_element()
Source code in xsdata/models/wsdl.py
160
161
162
163
164
165
166
167
168
@dataclass
class BindingMessage(ExtensibleElement):
    """WSDL Binding message model representation.

    Args:
        name: The message name
        documentation: The message documentation
        extended: The message extended elements
    """

BindingOperation dataclass

Bases: ExtensibleElement

WSDL Binding operation model representation.

Parameters:

Name Type Description Default
input BindingMessage

The input binding message instance

element()
output BindingMessage

The output binding message instance

element()
faults list[BindingMessage]

The list of error binding message instances

array_element(name='fault')
name str

The operation name

attribute()
documentation Documentation | None

The operation documentation

element()
extended list[object]

The operation extended elements

array_any_element()
Source code in xsdata/models/wsdl.py
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
@dataclass
class BindingOperation(ExtensibleElement):
    """WSDL Binding operation model representation.

    Args:
        input: The input binding message instance
        output: The output binding message instance
        faults: The list of error binding message instances
        name: The operation name
        documentation: The operation documentation
        extended: The operation extended elements
    """

    input: BindingMessage = element()
    output: BindingMessage = element()
    faults: list[BindingMessage] = array_element(name="fault")

Binding dataclass

Bases: ExtensibleElement

WSDL Binding model representation.

Parameters:

Name Type Description Default
name str

The binding name

attribute()
documentation Documentation | None

The binding documentation

element()
extended list[object]

The binding extended elements

array_any_element()
type str

The binding type

attribute()
operations list[BindingOperation]

The binding operations

array_element(name='operation')
Source code in xsdata/models/wsdl.py
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
@dataclass
class Binding(ExtensibleElement):
    """WSDL Binding model representation.

    Args:
        name: The binding name
        documentation: The binding documentation
        extended: The binding extended elements
        type: The binding type
        operations: The binding operations
    """

    type: str = attribute()
    operations: list[BindingOperation] = array_element(name="operation")

    def unique_operations(self) -> Iterator[BindingOperation]:
        """Yields all unique operation instances."""
        grouped_operations = collections.group_by(self.operations, key=get_name)

        for operations in grouped_operations.values():
            yield operations[-1]

unique_operations()

Yields all unique operation instances.

Source code in xsdata/models/wsdl.py
204
205
206
207
208
209
def unique_operations(self) -> Iterator[BindingOperation]:
    """Yields all unique operation instances."""
    grouped_operations = collections.group_by(self.operations, key=get_name)

    for operations in grouped_operations.values():
        yield operations[-1]

ServicePort dataclass

Bases: ExtensibleElement

WSDL Service port model representation.

Parameters:

Name Type Description Default
name str

The port name

attribute()
documentation Documentation | None

The port documentation

element()
extended list[object]

The port extended elements

array_any_element()
binding str

The port binding

attribute()
Source code in xsdata/models/wsdl.py
212
213
214
215
216
217
218
219
220
221
222
223
@dataclass
class ServicePort(ExtensibleElement):
    """WSDL Service port model representation.

    Args:
        name: The port name
        documentation: The port documentation
        extended: The port extended elements
        binding: The port binding
    """

    binding: str = attribute()

Service dataclass

Bases: WsdlElement

WSDL Service model representation.

Parameters:

Name Type Description Default
name str

The service name

attribute()
documentation Documentation | None

The service documentation

element()
ports list[ServicePort]

The service ports

array_element(name='port')
Source code in xsdata/models/wsdl.py
226
227
228
229
230
231
232
233
234
235
236
@dataclass
class Service(WsdlElement):
    """WSDL Service model representation.

    Args:
        name: The service name
        documentation: The service documentation
        ports: The service ports
    """

    ports: list[ServicePort] = array_element(name="port")

Definitions dataclass

Bases: ExtensibleElement

WSDL Definitions model representation.

Parameters:

Name Type Description Default
name str

The definition name

attribute()
documentation Documentation | None

The definition documentation

element()
extended list[object]

A list of generic elements

array_any_element()
types Types | None

The definition types

element()
imports list[Import]

The definition imports

array_element(name='import')
messages list[Message]

The definition messages

array_element(name='message')
port_types list[PortType]

The definition port types

array_element(name='portType')
bindings list[Binding]

The definition bindings

array_element(name='binding')
services list[Service]

The definition services

array_element(name='service')
Source code in xsdata/models/wsdl.py
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
@dataclass
class Definitions(ExtensibleElement):
    """WSDL Definitions model representation.

    Args:
        name: The definition name
        documentation: The definition documentation
        extended: A list of generic elements
        types: The definition types
        imports: The definition imports
        messages: The definition messages
        port_types: The definition port types
        bindings: The definition bindings
        services: The definition services
    """

    class Meta:
        """Metadata options."""

        name = "definitions"
        namespace = "http://schemas.xmlsoap.org/wsdl/"

    target_namespace: str | None = attribute(name="targetNamespace")
    types: Types | None = element()
    imports: list[Import] = array_element(name="import")
    messages: list[Message] = array_element(name="message")
    port_types: list[PortType] = array_element(name="portType")
    bindings: list[Binding] = array_element(name="binding")
    services: list[Service] = array_element(name="service")

    @property
    def schemas(self) -> Iterator[Schema]:
        """Yield all schema definitions."""
        if self.types:
            yield from self.types.schemas

    def find_binding(self, name: str) -> Binding:
        """Find a binding by name or raise an error."""
        return find_or_die(self.bindings, name, "Binding")

    def find_message(self, name: str) -> Message:
        """Find a message by name or raise an error."""
        return find_or_die(self.messages, name, "Message")

    def find_port_type(self, name: str) -> PortType:
        """Find a port type by name or raise an error."""
        return find_or_die(self.port_types, name, "PortType")

    def merge(self, source: "Definitions") -> None:
        """Merge the source instance with this instance."""
        if not self.types:
            self.types = source.types
        elif source.types:
            self.types.schemas.extend(source.types.schemas)

        self.messages.extend(source.messages)
        self.port_types.extend(source.port_types)
        self.bindings.extend(source.bindings)
        self.services.extend(source.services)
        self.extended.extend(source.extended)

    def included(self) -> Iterator[Import]:
        """Yield all imports."""
        yield from self.imports

schemas property

Yield all schema definitions.

Meta

Metadata options.

Source code in xsdata/models/wsdl.py
255
256
257
258
259
class Meta:
    """Metadata options."""

    name = "definitions"
    namespace = "http://schemas.xmlsoap.org/wsdl/"

find_binding(name)

Find a binding by name or raise an error.

Source code in xsdata/models/wsdl.py
275
276
277
def find_binding(self, name: str) -> Binding:
    """Find a binding by name or raise an error."""
    return find_or_die(self.bindings, name, "Binding")

find_message(name)

Find a message by name or raise an error.

Source code in xsdata/models/wsdl.py
279
280
281
def find_message(self, name: str) -> Message:
    """Find a message by name or raise an error."""
    return find_or_die(self.messages, name, "Message")

find_port_type(name)

Find a port type by name or raise an error.

Source code in xsdata/models/wsdl.py
283
284
285
def find_port_type(self, name: str) -> PortType:
    """Find a port type by name or raise an error."""
    return find_or_die(self.port_types, name, "PortType")

merge(source)

Merge the source instance with this instance.

Source code in xsdata/models/wsdl.py
287
288
289
290
291
292
293
294
295
296
297
298
def merge(self, source: "Definitions") -> None:
    """Merge the source instance with this instance."""
    if not self.types:
        self.types = source.types
    elif source.types:
        self.types.schemas.extend(source.types.schemas)

    self.messages.extend(source.messages)
    self.port_types.extend(source.port_types)
    self.bindings.extend(source.bindings)
    self.services.extend(source.services)
    self.extended.extend(source.extended)

included()

Yield all imports.

Source code in xsdata/models/wsdl.py
300
301
302
def included(self) -> Iterator[Import]:
    """Yield all imports."""
    yield from self.imports

find_or_die(items, name, type_name)

Find an item by name or raise an error.

Source code in xsdata/models/wsdl.py
308
309
310
311
312
313
314
def find_or_die(items: list[T], name: str, type_name: str) -> T:
    """Find an item by name or raise an error."""
    for msg in items:
        if msg.name == name:
            return msg

    raise CodegenError("Unknown WSDL Type", type=type_name, name=name)