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
13
14
15
16
17
18
19
20
21
@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 Optional[Documentation]

The element documentation

element()
location Optional[str]

The element location

None
ns_map

The element namespace prefix-URI map

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

    Args:
        name: The element name
        documentation: The element documentation
        location: The element location
        ns_map: The element namespace prefix-URI map
    """

    name: str = attribute()
    documentation: Optional[Documentation] = element()
    location: Optional[str] = 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 Optional[Documentation]

The element documentation

element()
location Optional[str]

The element location

None
ns_map

The element namespace prefix-URI map

required
extended List[object]

A list of generic elements

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

    Args:
        name: The element name
        documentation: The element documentation
        location: The element location
        ns_map: The element namespace prefix-URI map
        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: Iterator[AnyElement] 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 Optional[Documentation]

The type documentation

element()
Source code in xsdata/models/wsdl.py
63
64
65
66
67
68
69
70
71
72
73
@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: Optional[Documentation] = element()

Import dataclass

WSDL Import model representation.

Parameters:

Name Type Description Default
location Optional[str]

The location URI

attribute()
namespace Optional[str]

The namespace URI

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

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

    location: Optional[str] = attribute()
    namespace: Optional[str] = attribute()

Part dataclass

Bases: WsdlElement

WSDL Part model representation.

Parameters:

Name Type Description Default
name str

The part name

attribute()
documentation Optional[Documentation]

The part documentation

element()
location Optional[str]

The part location

None
ns_map

The part namespace prefix-URI map

required
type Optional[str]

The part type

attribute()
element Optional[str]

The part element

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

    Args:
        name: The part name
        documentation: The part documentation
        location: The part location
        ns_map: The part namespace prefix-URI map
        type: The part type
        element: The part element
    """

    type: Optional[str] = attribute()
    element: Optional[str] = attribute()

Message dataclass

Bases: WsdlElement

WSDL Message model representation.

Parameters:

Name Type Description Default
name str

The message name

attribute()
documentation Optional[Documentation]

The message documentation

element()
location Optional[str]

The message location

None
ns_map

The message namespace prefix-URI map

required
parts List[Part]

The message parts

array_element(name='part')
Source code in xsdata/models/wsdl.py
106
107
108
109
110
111
112
113
114
115
116
117
118
@dataclass
class Message(WsdlElement):
    """WSDL Message model representation.

    Args:
        name: The message name
        documentation: The message documentation
        location: The message location
        ns_map: The message namespace prefix-URI map
        parts: The message parts
    """

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

PortTypeMessage dataclass

Bases: WsdlElement

WSDL Port type message model representation.

Args: name: The port type name documentation: The port type documentation location: The port type location ns_map: The port type namespace prefix-URI map message: The port type message

Source code in xsdata/models/wsdl.py
121
122
123
124
125
126
127
128
129
130
131
132
133
134
@dataclass
class PortTypeMessage(WsdlElement):
    """WSDL Port type message model representation.

    Args:
    Args:
        name: The port type name
        documentation: The port type documentation
        location: The port type location
        ns_map: The port type namespace prefix-URI map
        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
137
138
139
140
141
142
143
144
145
146
147
148
149
@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 Optional[Documentation]

The port type documentation

element()
location Optional[str]

The port type location

None
ns_map

The port type namespace prefix-URI map

required
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
@dataclass
class PortType(ExtensibleElement):
    """WSDL Port type model representation.

    Args:
        name: The port type name
        documentation: The port type documentation
        location: The port type location
        ns_map: The port type namespace prefix-URI map
        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
167
168
169
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 Optional[Documentation]

The message documentation

element()
location Optional[str]

The message location

None
ns_map

The message namespace prefix-URI map

required
extended List[object]

The message extended elements

array_any_element()
Source code in xsdata/models/wsdl.py
172
173
174
175
176
177
178
179
180
181
182
@dataclass
class BindingMessage(ExtensibleElement):
    """WSDL Binding message model representation.

    Args:
        name: The message name
        documentation: The message documentation
        location: The message location
        ns_map: The message namespace prefix-URI map
        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 Optional[Documentation]

The operation documentation

element()
location Optional[str]

The operation location

None
ns_map

The operation namespace prefix-URI map

required
extended List[object]

The operation extended elements

array_any_element()
Source code in xsdata/models/wsdl.py
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
@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
        location: The operation location
        ns_map: The operation namespace prefix-URI map
        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 Optional[Documentation]

The binding documentation

element()
location Optional[str]

The binding location

None
ns_map

The binding namespace prefix-URI map

required
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
@dataclass
class Binding(ExtensibleElement):
    """WSDL Binding model representation.

    Args:
        name: The binding name
        documentation: The binding documentation
        location: The binding location
        ns_map: The binding namespace prefix-URI map
        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
222
223
224
225
226
227
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 Optional[Documentation]

The port documentation

element()
location Optional[str]

The port location

None
ns_map

The port namespace prefix-URI map

required
extended List[object]

The port extended elements

array_any_element()
binding str

The port binding

attribute()
Source code in xsdata/models/wsdl.py
230
231
232
233
234
235
236
237
238
239
240
241
242
243
@dataclass
class ServicePort(ExtensibleElement):
    """WSDL Service port model representation.

    Args:
        name: The port name
        documentation: The port documentation
        location: The port location
        ns_map: The port namespace prefix-URI map
        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 Optional[Documentation]

The service documentation

element()
location Optional[str]

The service location

None
ns_map

The service namespace prefix-URI map

required
ports List[ServicePort]

The service ports

array_element(name='port')
Source code in xsdata/models/wsdl.py
246
247
248
249
250
251
252
253
254
255
256
257
258
@dataclass
class Service(WsdlElement):
    """WSDL Service model representation.

    Args:
        name: The service name
        documentation: The service documentation
        location: The service location
        ns_map: The service namespace prefix-URI map
        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 Optional[Documentation]

The definition documentation

element()
location Optional[str]

The definition location

None
ns_map

The definition namespace prefix-URI map

required
extended List[object]

A list of generic elements

array_any_element()
types Optional[Types]

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')
extended List[object]

The definition extended elements

array_any_element()
Source code in xsdata/models/wsdl.py
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
@dataclass
class Definitions(ExtensibleElement):
    """WSDL Definitions model representation.

    Args:
        name: The definition name
        documentation: The definition documentation
        location: The definition location
        ns_map: The definition namespace prefix-URI map
        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
        extended: The definition extended elements
    """

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

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

    target_namespace: Optional[str] = attribute(name="targetNamespace")
    types: Optional[Types] = 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"):
        """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: Iterator[Schema] property

Yield all schema definitions.

Meta

Metadata options.

Source code in xsdata/models/wsdl.py
280
281
282
283
284
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
300
301
302
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
304
305
306
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
308
309
310
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
312
313
314
315
316
317
318
319
320
321
322
323
def merge(self, source: "Definitions"):
    """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
325
326
327
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
333
334
335
336
337
338
339
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)