SOAP (Simple Object Access Protocol) è un protocollo basato su XML per lo scambio di informazioni strutturate in ambienti distribuiti. Un nodo SOAP è qualsiasi entità (client, server, intermediario) che processa un messaggio SOAP lungo il suo percorso.
Architettura di processamento SOAP
Un messaggio SOAP viaggia attraverso una catena di nodi SOAP:
- Initial SOAP Sender: origina il messaggio (client)
- SOAP Intermediaries: zero o più nodi che processano/rinviano (gateway, proxy, ESB, security filter, logging)
- Ultimate SOAP Receiver: destinazione finale che processa il body (web service endpoint)
Ogni nodo deve comprendere l'elemento <soap:Envelope> e le regole di processamento (SOAP 1.1/1.2 spec).
Struttura messaggio SOAP
<soap:Envelope xmlns:soap="https://www.w3.org/2003/05/soap-envelope/">
<soap:Header>
<!-- Header blocks: routing, auth, transaction, correlation -->
<wsse:Security>...</wsse:Security>
<wsa:Action>GetUser</wsa:Action>
<wsa:MessageID>uuid:...</wsa:MessageID>
</soap:Header>
<soap:Body>
<!-- Payload applicativo -->
<ns:GetUserRequest>
<ns:UserId>12345</ns:UserId>
</ns:GetUserRequest>
</soap:Body>
<soap:Fault> <!-- Solo in risposta se errore -->
<soap:Code><soap:Value>soap:Sender</soap:Value></soap:Code>
<soap:Reason><soap:Text xml:lang="en">Invalid UserId</soap:Text></soap:Reason>
<soap:Detail>...</soap:Detail>
</soap:Fault>
</soap:Envelope>
Ruoli e attributi nodo SOAP
L'attributo soap:role (SOAP 1.2) o soap:actor (SOAP 1.1) su header blocks identifica il nodo target:
https://www.w3.org/2003/05/soap-envelope/role/next— prossimo nodo (default)https://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver— destinatario finale- URI custom — intermediari specifici (es.
https://example.com/roles/logger)
Attributo soap:mustUnderstand="1|true": il nodo deve comprendere e processare quel header block, altrimenti genera soap:MustUnderstand fault.
Processamento per nodo
- Identifica header blocks targettizzati al proprio ruolo
- Se
mustUnderstande non compreso → Fault - Processa header blocks (auth, logging, routing, transformazione)
- Rimuove header blocks processati (obbligatorio)
- Inoltra a prossimo nodo (se non ultimate receiver)
Binding e trasporti
| Trasporto | Binding SOAP | Uso tipico |
|---|---|---|
| HTTP/HTTPS | SOAP over HTTP (POST, Content-Type: application/soap+xml) | Standard web services, firewall-friendly |
| SMTP/Email | SOAP over Email | Async, store-and-forward |
| TCP raw | SOAP over TCP (RFC 3879) | High-performance, internal |
| MQ/JMS | SOAP over JMS | Enterprise messaging, reliability |
| UDP | SOAP over UDP (multicast) | Discovery, notification |