WS-Security vs TLS is not an either/or choice, because the two protect different things. TLS protects a SOAP message only while it crosses one connection, and its protection ends at every node that terminates that connection. WS-Security signs and encrypts the message itself, so authenticity and integrity survive intermediaries and the signed message can be kept as evidence. That is why specifications such as the EU’s eDelivery AS4 profile require both layers.
Last reviewed: 25 October 2026. Statements about specific authority specifications are as of that date.
This guide is for a vendor building a government SOAP web service integration, where SOAP API security comes down to choosing which layer protects against which threat. The main reference, NIST’s SP 800-95, Guide to Secure Web Services, dates from August 2007, but its core point holds: the current TLS 1.3 specification, RFC 9846, still describes TLS as a channel between two peers.
Why do many authority gateways still use SOAP?
The published specifications point to two reasons: SOAP messages can carry signatures that make them usable as evidence, and WSDL gives each service a formal contract. Three examples show the pattern of a SOAP-based message format, message-level signatures and transport security on top. They describe what each requires, not market share.
- X-Road. Its architecture document sets the design goal that every message is usable as digital evidence. Security servers log messages with their signatures, time-stamp the logs periodically, and authenticate each other with mutual certificate-based TLS.
- eDelivery AS4 2.0. The European Commission’s specification, published on 5 December 2024, uses SOAP 1.2 and makes WS-Security 1.1.1 mandatory. It requires X.509 tokens for signing and encryption, does not support username tokens, and requires signing before encryption. It also says “message exchange MUST be secured using both transport layer security and message layer security”.
- Portugal’s tax authority (AT). Its manual for invoice-data web services (version 1.0, June 2022) builds the SOAP header to WS-Security and the Username Token Profile 1.1. The password and the Created timestamp are encrypted with a per-request symmetric key, which is itself encrypted with the RSA public key of the authority’s authentication system. Calls also need HTTPS with an SSL certificate previously submitted to and signed by AT.
The WSDL contract lists the operations a service exposes and the parameters and message types each expects, as Yau and Rao describe in Web Services Security and E-Business (Idea Group, 2007).
What TLS protects and what it doesn’t
Is TLS enough for SOAP? Only when the two ends of the TLS connection are the two parties that need to trust the message. RFC 9846 states the primary goal of TLS as a secure channel between two communicating peers, with the server always authenticated and the client optionally authenticated. NIST draws the consequence for SOAP: messages can pass through intermediaries, TLS secures transactions between individual web services, and it will not protect against an intermediary performing a man-in-the-middle attack.
The SOAP 1.2 specification defines an intermediary as a node that is both a receiver and a sender, so whatever arrives over TLS is decrypted by the node that terminates it and forwarded on a new connection. SOAP itself adds nothing here: it leaves security out of the messaging framework and defers it to extensions. NIST, citing the WS-I, lists the result: no authentication between SOAP endpoints or intermediaries, no integrity or confidentiality mechanism, and no detection of resubmitted messages.
NIST’s Table 2-2 rates standards against nine threats: message alteration, loss of confidentiality, falsified messages, man in the middle, principal spoofing, forged claims, replay of a message, replay of message parts, and denial of service. Counting the marks in each row:
| Standard | Threats marked (of 9) | Protection reaches as far as |
|---|---|---|
| TLS, server authentication only | 7, three of them only for provider-to-requester messages | The TLS connection |
| TLS with client certificates (mutual TLS) | 7 | The TLS connection |
| XML Signature | 6 | Wherever the signed message travels, and into storage |
| XML Encryption | 5 | The same, for the encrypted parts |
Coverage is not the difference: NIST reads the table as showing that TLS and WS-Security provide similar protections. The difference is reach, plus two details. Plain TLS mitigates three of its seven threats only for provider-to-requester messages; client certificates remove that condition on the direct connection. And no row protects against denial of service. NIST accepts HTTP and TLS authentication over a direct connection between two endpoints, but not once a message passes through several SOAP endpoints, because nothing guarantees that a service handling the message did not misuse or store the data.
What does WS-Security add that TLS can’t?
WS-Security moves protection into the SOAP message: XML Signature for integrity and sender authentication, XML Encryption for confidentiality of all or part of the message, and security tokens that carry credentials. The OASIS WS-Security 1.1.1 standard lists as a requirement “End-to-end message content security and not just transport-level security”. An XML Signature over the SOAP message lets the receiver check who sent it and whether it changed. NIST gives three reasons this is needed on top of secure transport:
- End-to-end security. Transport security assures messages only during transmission, so intermediaries that are not fully trusted break it.
- Transport independence. Even with trusted intermediaries, the originator’s authenticity must be translated into each next transport on the path, which NIST says is tedious, complex and may lead to breaches.
- Stored messages. Once a transmission is decrypted, transport security no longer protects the data, so store-and-forward flows need message-layer protection.
WS-Security tokens can be a username and password, a SAML assertion, an X.509 certificate, a Rights Expression Language token or a Kerberos token, per NIST. Authorities choose differently: AS4 requires X.509 and rejects username tokens, while AT’s manual is built on a username token. The token type is a contract detail you read in the authority’s manual, not a choice you make.
Signatures also give you evidence. NIST notes that because integrity rests on digital signatures, logging individual messages can provide non-repudiation. That is the property X-Road builds on when it logs messages with their signatures.
The cost: asymmetric crypto per message
NIST names WS-Security’s main drawback as its use of asymmetric algorithms for encryption, which are computationally intensive. WS-SecureConversation addresses this by letting services establish a symmetric session key, much as TLS does, and NIST describes it as well suited to services that exchange large volumes of messages with a small number of other services. A second cost is key distribution: a service needs the public keys of every node it interacts with, not just those it talks to directly. Whether an authority permits session keys is a question for its technical manual.
Which XML-specific attacks should you test for?
Test your own parser and gateway for six attacks: oversized and recursive payloads, external entities, schema poisoning, WSDL scanning, routing detours, and replay or flooding. Most target XML processing rather than the channel, so NIST handles them through parser configuration and XML gateways, not the security standards. Run the tests against your own stack, and check the sandbox terms before sending malformed or oversized payloads to an authority’s endpoint.
- Oversized and recursive payloads. NIST warns that an attacker can build a document 10,000 or 100,000 elements deep, and that large or recursive documents can overload the parser. Its fix is to configure the web server to accept messages only up to a set size.
- External entities. An XML external entity (XXE) attack against a SOAP parser works because documents can refer to local files, letting an attacker learn about the local system. OWASP defines XXE as an XML processor resolving an external entity from untrusted input, and its prevention cheat sheet says to disable DTDs whenever possible. This applies to clients too: your parser reads the authority’s responses.
- Schema poisoning. NIST describes an attacker supplying a schema with the document so the validator uses it and accepts a malicious payload. The defence is to validate against local schemas, not schemas that arrive with the traffic. Yau and Rao describe a variant in which a stored schema is replaced.
- WSDL scanning. Appending ?wsdl to a service URI usually returns its WSDL, which can reveal the entire API, including operations that were disabled or exist only for debugging. Yau and Rao add that attackers also guess unpublished operations. WSDL exposure makes every other attack cheaper.
- Routing detours. A compromised intermediary can insert routing instructions, for example through WS-Addressing, sending the message to a malicious location or to a nonexistent destination. NIST notes that WS-Security supports signing the SOAP header, which lets the receiver confirm that sender and recipient have not changed since the message was sent.
- Replay and flooding. An attacker can copy valid requests and resend them. NIST points out this may pass as normal traffic because the source address, the packets and the SOAP message are all valid; only the business behaviour is not.
NIST’s control for most of these is an XML gateway: a proxy that presents itself as the web service, applies authentication and authorization, validates schemas, screens for the attacks above, and keeps audit logs. Its caveats: a gateway is only as good as its feature set and policy granularity, it is itself exposed to attack and needs updates, and services behind it should still use WS-Security or HTTPS, because an attacker who bypasses the gateway otherwise reaches them unprotected.
Denial of service needs knowledge of each service. NIST’s example contrasts a query service that might handle 1,000 requests per second with a multi-service financial system that might handle five per hour: ten requests an hour is an attack on the second and nothing to the first, a difference firewalls and intrusion detection systems cannot see.
Integration checklist
Before go-live on a government SOAP web service integration, work through these checks:
- Certificates. Identify which certificate each layer needs. AT’s test endpoint accepts only the test certificate, which must be replaced for production. NIST warned in 2007 that most WS-Security, SAML and XML security libraries skip full certificate validation by default and are not configured to check CRLs or OCSP, so test revocation checking in your own stack.
- Clock sync. AT requires the Created timestamp in UTC, ISO 8601 format, and says it is crucial that the client’s clock is correct, suggesting synchronisation with the Observatório Astronómico de Lisboa. WS-Security timestamps carry an expiry and leave the recipient to decide how far to trust the sender’s clock, so drift on your side can get valid requests rejected.
- Replay protection. NIST says timestamps, sequence numbers and expirations should be signed inside the message and checked by the receiver. Under AT’s scheme each call must carry a randomly generated key that cannot repeat, so a retry has to be rebuilt with a fresh key and timestamp, not resent as captured.
- Signed parts. NIST warns that WS-Security tokens can be substituted unless the appropriate portions of the message are signed. Sign the body, the timestamp and any token the receiver relies on, and where encryption is also required, sign first: AS4 requires signing before encryption.
- WSDL exposure. Remove debugging operations and restrict who can fetch the WSDL of any SOAP endpoint you run, such as a callback receiver. Disable DTDs, cap message size and validate against local schemas on the same endpoint.
- Signed message logs. NIST describes storing the important WS-Security signed elements for audit, to determine which service performed what action. Keep the signed request and response exactly as sent and received.
- The authority’s manual. Follow it over any generic profile. AT’s header variant encrypts the credentials inside the username token, and an off-the-shelf WS-Security client may not produce it as specified, so test in the sandbox.
Frequently asked questions
Does mTLS replace WS-Security?
No. Mutual TLS authenticates both ends of a single connection, but the protection ends when the connection does. NIST gives TLS with client certificates seven threat marks, yet still lists end-to-end security, transport independence and stored messages as reasons for message-layer security. AS4 requires both layers, and X-Road pairs mutual TLS with signed, logged messages. Mutual TLS alone suits only a single hop where you control both ends and nobody needs the message as evidence later.
Why does my signed SOAP request fail after a proxy?
A signature verifies only if the receiver computes the same digest over each signed element that the sender did. A proxy that only forwards TLS traffic does not touch the signed XML; one that adds, removes or rewrites a header, or alters the body, does. XML Signature canonicalizes the XML before hashing, so harmless formatting differences are normally absorbed, and a failure points to a changed value or a mismatch in the declared canonicalization. Also check the timestamp: a request held in a queue, or sent from a drifting clock, can fail the Created and Expires check even when the signature is valid.
Is SOAP being phased out by authorities?
Not as a rule, as of 25 October 2026. Some are moving: Australia’s Department of Employment and Workplace Relations is updating the National Training Register web services from SOAP to REST, with no published timeline. Others still issue SOAP-based specifications: eDelivery AS4 2.0 was published in December 2024 and uses SOAP 1.2, X-Road’s protocol supports both SOAP and REST, and AT’s June 2022 manual is SOAP. Build to the interface the authority documents today, and ask its integration desk whether a REST successor and a retirement date exist.
