Skip to content

Commit bcf82d8

Browse files
eblismvantellingen
authored andcommitted
Allow Ws Addressing plugin to use a different URL address than the binding address.
Some SOAP services require you to connect to a gateway server but specify your actual url in the addressing part. With this change you can override the binding address if you want to, but by default it will use the same address.
1 parent cc986db commit bcf82d8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/zeep/wsa.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
class WsAddressingPlugin(Plugin):
1414
nsmap = {"wsa": ns.WSA}
1515

16+
def __init__(self, address_url: str = None):
17+
self.address_url = address_url
18+
1619
def egress(self, envelope, http_headers, operation, binding_options):
1720
"""Apply the ws-addressing headers to the given envelope."""
1821

@@ -24,7 +27,7 @@ def egress(self, envelope, http_headers, operation, binding_options):
2427
headers = [
2528
WSA.Action(wsa_action),
2629
WSA.MessageID("urn:uuid:" + str(uuid.uuid4())),
27-
WSA.To(binding_options["address"]),
30+
WSA.To(self.address_url or binding_options["address"]),
2831
]
2932
header.extend(headers)
3033

0 commit comments

Comments
 (0)