Skip to content
Tutorials Center
My learning

Topics

Lesson 5 of 36 ยท Getting Started

Roles, Nodes and the Service Triangle

Understand SOAP senders, receivers and intermediaries, the provider-requester-registry triangle, and the stack of standards, with a runnable gateway that forwards messages.

So far a SOAP message went straight from a client to a service. Real deployments are rarely that simple: a message may pass through a gateway that checks security, a router that picks a data center, and an audit service that logs it, before the business code ever sees it. SOAP has a vocabulary for this, and knowing it makes WS-* specifications and WSDL files much easier to read.

SOAP nodes

A SOAP node is any program that sends, receives or processes SOAP messages. Nodes play roles:

Role Meaning
Initial sender Creates the message. Usually the client application.
Intermediary Receives a message, processes the header blocks meant for it, and forwards it. Examples: gateways, firewalls, audit loggers, routers.
Ultimate receiver The node that finally processes the body. The business service.
flowchart LR
    A["Initial sender<br/>(client)"] --> B["Intermediary<br/>(API gateway)"]
    B --> C["Intermediary<br/>(audit logger)"]
    C --> D["Ultimate receiver<br/>(service)"]

Intermediaries touch header blocks addressed to them; only the ultimate receiver processes the body.

An intermediary never changes the body. It may read, add, remove or change header blocks that are addressed to its role. This is how security tokens are checked at the edge, how routing information is stamped, and how every hop can add a trace id.

Header blocks and roles

A header block can carry a role attribute (SOAP 1.2; actor in 1.1) that names who must process it. Two roles are predefined in SOAP 1.2:

  • http://www.w3.org/2003/05/soap-envelope/role/next: every node on the path.
  • http://www.w3.org/2003/05/soap-envelope/role/ultimateReceiver: only the last node.

A header block marked mustUnderstand="true" says: "if you are the target node and do not understand this block, you must not process the message, and you must return a fault". That rule is what lets new features such as security be added safely. SOAP Header and Body works through header blocks in detail.

A gateway you can run

The next program builds a chain of three nodes in memory: a gateway that stamps a trace id and removes a block meant for it, then a service that answers. Each node is a plain function so you can follow what happens to the message.

Node.js Intermediary and ultimate receiver

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The service never saw the auth block: the gateway consumed it. It did see the trace block the gateway added. This pattern, intermediaries enriching or checking messages, is why SOAP has headers separate from the body.

The service triangle

Early web-service writers described three parties and three operations, drawn as a triangle:

flowchart TD
    R["Service registry<br/>(UDDI, directory)"]
    P["Service provider"]
    C["Service requester"]
    P -- "1 publish" --> R
    C -- "2 find" --> R
    C -- "3 bind and call" --> P

Publish, find, bind: the original web-services model.

  1. The provider publishes a description of its service (a WSDL) in a registry.
  2. A requester searches the registry for a service that fits.
  3. The requester binds to the provider and calls it.

The registry standard was UDDI (Universal Description, Discovery and Integration). It was a good idea that rarely worked in public: companies preferred to exchange WSDL files directly or publish them at a known URL (https://host/service?wsdl). Inside large companies, registries survive under names such as service catalog or API portal. You will still see the triangle in older diagrams.

The next demo is a miniature registry: providers publish, requesters look up by capability.

Node.js A tiny service registry

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with node:readline or process.stdin), it gets the next line from this box.

The stack of standards

SOAP alone only defines the envelope. Around it grew a stack of specifications, often called WS-*:

Layer Standards
Description WSDL, XML Schema, WS-Policy
Messaging SOAP, WS-Addressing, MTOM (attachments)
Security WS-Security, WS-Trust, WS-SecureConversation
Reliability and transactions WS-ReliableMessaging, WS-AtomicTransaction
Discovery UDDI, WS-Discovery

WS-Security and Standards in chapter 4 returns to this list. You do not need all of it to build a useful service: most services use only SOAP, WSDL, XSD and one security mechanism.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What may a SOAP intermediary change?

    Intermediaries process header blocks meant for their role (read, add, remove, modify) but must not change the body.
  2. 2. What does mustUnderstand="true" on a header block mean?

    A node that is the target of such a block and does not understand it must not process the message and must return a fault.
  3. 3. In the original service triangle, who stores service descriptions?

    The provider publishes its description into a registry (such as UDDI) and the requester finds it there.
  4. 4. Which node processes the body of the message?

    Only the ultimate receiver processes the body; intermediaries handle headers.

Summary

  • A SOAP node is any program that sends, receives or processes SOAP messages: initial sender, intermediary or ultimate receiver.
  • Intermediaries act on header blocks addressed to their role; only the ultimate receiver handles the body.
  • mustUnderstand makes extensions safe to add.
  • The publish-find-bind triangle with UDDI was the original discovery model; direct WSDL exchange won in practice.
  • WS-* standards (security, addressing, reliability) build on the envelope.

Next: XML Basics for SOAP