3.2.5.1 RECEIVE_CM

The RECEIVE_CM event MUST be signaled by the underlying transport protocol with the following arguments:

  • The Client Message argument.

  • The Protocol argument with two possible values: HTTP or SOAP.

If the RECEIVE_CM event is signaled, the server role implementation MUST perform the following actions:

  • Initialize the NEW_CONTEXT Boolean local data element to false.

  • If the client message is a Context Participating Message:

    • Create the context identifier from the Context Participating Message by performing the following steps:

      • If the Protocol value is HTTP and the client message is an HTTP request message [RFC2616]:

      • Else if the Protocol value is SOAP and the server message is a SOAP envelope:

        • Create a context identifier that is isomorphic with the SOAP header from the client message that matches the CONTEXT_XML element.

      • Otherwise:

        • Return an implementation-specific failure result to the higher-layer business logic.

    • Invoke a function in the higher-layer business logic that accepts the created context identifier and the value from the Context Identifier Store field; and returns one of three values: PARTICIPATE, NEW, or FAIL.

    • If the value that is returned from the higher-layer business logic is PARTICIPATE:

      • Provide the client message to the higher-layer business logic.

      • Set NEW_CONTEXT to false.

    • Else if the value that is returned from the higher-layer business logic is NEW:

      • Set the Context Identifier Store field to an empty value.

      • Set NEW_CONTEXT to true.

    • Otherwise:

      • Return an implementation-specific failure result to the higher-layer business logic.

  • Otherwise:

    • Set NEW_CONTEXT to true.

  • If NEW_CONTEXT is true:

    • If the Context Identifier Store field is empty:

      • Invoke a function in the higher-layer business logic that returns a context identifier.

      • Invoke a function in the higher-layer business logic that accepts the client message and returns a correlated server message using a correlation mechanism that is supplied by the underlying transport protocol.

      • Transform the server message to a Server Context Establishing Message by performing the following steps:

        • If the Protocol value is HTTP and the server message is an HTTP response message [RFC2616]:

          • Create an HTTP Server Message Header that is isomorphic with the context identifier.

          • Add the HTTP Server Message Header to the server message [RFC2616].

        • Else if the Protocol value is SOAP and the server message is a SOAP envelope:

          • Create a CONTEXT_XML element that is isomorphic with the context identifier.

          • Add the CONTEXT_XML element to the server message as a SOAP header.

        • Otherwise:

          • Return an implementation-specific failure result to the higher-layer business logic.

      • Send the Server Context Establishing Message to the client role by using the underlying transport protocol.

      • Set the Context Identifier Store field to the value of the context identifier that is returned by higher-layer business logic.

    • Otherwise:

      • Return an implementation-specific failure result to the higher-layer business logic.

  • Invoke a function in the higher-layer business logic that accepts the client message and returns a (possibly empty) collection of correlated server messages by using a correlation mechanism that is supplied by the underlying transport protocol.

  • For each server message in the collection of the server messages:

    • Send the server message to the client role by using the underlying transport protocol.