Mode:

Compact lists

Showing:

Documentation
Used by
References
Source

Table of Contents

Group by:
Main stylesheet AS4_Receipt_updated.xsl
Documentation

Description

Created on: Dec 13, 2011

Author: pvde

This XSLT stylesheet is a non-normative part of the OASIS AS4 specification. It shows how AS4 messages can be derived from AS4 user messages.

Parameters

messageid

The messageid to use on the AS4 receipt signal message

timestamp

The timestamp to set on the AS4 receipt signal message

start

To generate a receipt for a SOAP-with-attachments message, pass the value of the start parameter that contains the MIME Content-Id of MIME part containing the SOAP root element.

Stylesheet version 1.0
[ top ]
Template S12:Envelope
Namespace No namespace
Match S12:Envelope
Mode #default
Import precedence 0
Source
<xsl:template match="S12:Envelope">
  <S12:Envelope>
    <xsl:apply-templates/>
  </S12:Envelope>
</xsl:template>
[ top ]
Template S12:Header
Namespace No namespace
Match S12:Header
Mode #default
Import precedence 0
Source
<xsl:template match="S12:Header">
  <S12:Header>
    <xsl:apply-templates select="eb3:Messaging"/>
  </S12:Header>
</xsl:template>
[ top ]
Template S12:Envelope[S12:Header//ds:Signature]/S12:Body
Documentation

Description

When generating a receipt for a signed message, the receipt will be signed as well. We generate an identifier for the empty SOAP Body of the AS4 receipt for the WS-Security module.
Namespace No namespace
Match S12:Envelope[S12:Header//ds:Signature]/S12:Body
Mode #default
Import precedence 0
Source
<xsl:template match="S12:Envelope[S12:Header//ds:Signature]/S12:Body">
  <S12:Body wsu:Id="{generate-id()}"/>
</xsl:template>
[ top ]
Template S12:Envelope[not(S12:Header//ds:Signature)]/S12:Body
Documentation

Description

The empty body of receipt signal receipt for an unsigned message does not need an identifier
Namespace No namespace
Match S12:Envelope[not(S12:Header//ds:Signature)]/S12:Body
Mode #default
Import precedence 0
Source
<xsl:template match="S12:Envelope[not(S12:Header//ds:Signature)]/S12:Body">
  <S12:Body/>
</xsl:template>
[ top ]
Template eb3:Messaging[ @S12:role='http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh']
Documentation

Description

There are two templates for eb3:Messaging element. This first template is for an AS4 user message that may have been exchanged over a multi-hop network. The receipt for such a message has WS-Addressing headers and routing parameter based on the user message content as described in ebMS 3 Part 2 and AS4.
Namespace No namespace
Match eb3:Messaging[ @S12:role='http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh']
Mode #default
Import precedence 0
Source
<xsl:template match="eb3:Messaging[         @S12:role='http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh']">
  <xsl:variable name="mpc">
    <xsl:choose>
      <xsl:when test="descendant::eb3:UserMessage[1]/@mpc">
        <xsl:value-of select="descendant::eb3:UserMessage[1]/@mpc"/>
      </xsl:when>
      <xsl:otherwise>http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/defaultMPC</xsl:otherwise>
    </xsl:choose>
  </xsl:variable>
  <wsa:To wsu:Id="{concat('_wsato_',generate-id())}" S12:role="http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh" S12:mustUnderstand="true">http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/icloud</wsa:To>
  <wsa:Action wsu:Id="{concat('_wsaaction_',generate-id())}">http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/core/200704/oneWay.receipt</wsa:Action>
  <ebint:RoutingInput wsa:IsReferenceParameter="true" id="{concat('_ebroutinginput_',generate-id())}" S12:mustUnderstand="true" S12:role="http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh">
    <ebint:UserMessage mpc="{concat($mpc,                 '.receipt')}">
      <eb3:PartyInfo>
        <eb3:From>
          <xsl:copy-of select="descendant::eb3:UserMessage[1]//eb3:To/eb3:PartyId"/>
          <xsl:copy-of select="descendant::eb3:UserMessage[1]//eb3:To/eb3:Role"/>
        </eb3:From>
        <eb3:To>
          <xsl:copy-of select="descendant::eb3:UserMessage[1]//eb3:From/eb3:PartyId"/>
          <xsl:copy-of select="descendant::eb3:UserMessage[1]//eb3:From/eb3:Role"/>
        </eb3:To>
      </eb3:PartyInfo>
      <eb3:CollaborationInfo>
        <xsl:copy-of select="descendant::eb3:UserMessage[1]//eb3:Service"/>
        <eb3:Action>
          <xsl:value-of select="concat(descendant::eb3:UserMessage[1]//eb3:Action,                         '.receipt')"/>
        </eb3:Action>
        <xsl:copy-of select="descendant::eb3:UserMessage[1]//eb3:ConversationId"/>
      </eb3:CollaborationInfo>
    </ebint:UserMessage>
  </ebint:RoutingInput>
  <eb3:Messaging S12:mustUnderstand="true" id="{concat('_ebmessaging_',generate-id())}">
    <xsl:apply-templates select="descendant-or-self::eb3:UserMessage"/>
  </eb3:Messaging>
</xsl:template>
[ top ]
Template eb3:Messaging[not( @S12:role='http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh')]
Documentation

Description

There are two templates for eb3:Messaging element. This second template covers regular point-to-point messages.
Namespace No namespace
Match eb3:Messaging[not( @S12:role='http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh')]
Mode #default
Import precedence 0
Source
<xsl:template match="eb3:Messaging[not(         @S12:role='http://docs.oasis-open.org/ebxml-msg/ebms/v3.0/ns/part2/200811/nextmsh')]">
  <eb3:Messaging S12:mustUnderstand="true" id="{concat('_ebmessaging_',generate-id())}">
    <xsl:apply-templates select="descendant-or-self::eb3:UserMessage"/>
  </eb3:Messaging>
</xsl:template>
[ top ]
Template eb3:UserMessage
Documentation

Description

The AS4 receipt is generated based on eb3:UserMessage content.

  • A receipt for a signed AS4 message reference the message parts using ds:References in the WS-Security header of that message
  • A receipt for an unsigned AS4 message references the message parts using ebbp:MessagePartIdentifiers for the AS4 message structure corresponding to the eb3:PartInfo elements in the received message.
    • If the message is a SOAP-with-attachments structure, the MIME part identifier for the root SOAP element is available in the start parameter
    • If the message is a plain SOAP message, the SOAP envelop does not have a separate part identifier. We use the eb3:MessageId as part identifier.
Namespace No namespace
Match eb3:UserMessage
Mode #default
References
Parameters
Import precedence 0
Source
<xsl:template match="eb3:UserMessage">
  <eb3:SignalMessage>
    <eb3:MessageInfo>
      <eb3:Timestamp>
        <xsl:value-of select="$timestamp"/>
      </eb3:Timestamp>
      <eb3:MessageId>
        <xsl:value-of select="$messageid"/>
      </eb3:MessageId>
      <eb3:RefToMessageId>
        <xsl:value-of select="descendant::eb3:MessageId"/>
      </eb3:RefToMessageId>
    </eb3:MessageInfo>
    <eb3:Receipt>
      <xsl:choose>
        <xsl:when test="/S12:Envelope/S12:Header/wsse:Security/ds:Signature">
          <ebbp:NonRepudiationInformation>
            <xsl:apply-templates select="//ds:Reference"/>
          </ebbp:NonRepudiationInformation>
        </xsl:when>
        <xsl:otherwise>
          <ebbp:NonRepudiationInformation>
            <xsl:choose>
              <xsl:when test="$start != 'None'">
                <ebbp:MessagePartNRInformation>
                  <ebbp:MessagePartIdentifier>
                    <xsl:value-of select="$start"/>
                  </ebbp:MessagePartIdentifier>
                </ebbp:MessagePartNRInformation>
              </xsl:when>
              <xsl:otherwise>
                <ebbp:MessagePartNRInformation>
                  <ebbp:MessagePartIdentifier>
                    <xsl:value-of select="descendant::eb3:MessageId"/>
                  </ebbp:MessagePartIdentifier>
                </ebbp:MessagePartNRInformation>
              </xsl:otherwise>
            </xsl:choose>
            <xsl:apply-templates select="//eb3:PartInfo"/>
          </ebbp:NonRepudiationInformation>
        </xsl:otherwise>
      </xsl:choose>
    </eb3:Receipt>
  </eb3:SignalMessage>
</xsl:template>
[ top ]
Template ds:Reference
Namespace No namespace
Match ds:Reference
Mode #default
Import precedence 0
Source
<xsl:template match="ds:Reference">
  <ebbp:MessagePartNRInformation>
    <xsl:copy-of select="current()"/>
  </ebbp:MessagePartNRInformation>
</xsl:template>
[ top ]
Template eb3:PartInfo[starts-with(@href,'cid:')]
Documentation

Description

There are two templates for eb3:PartInfo elements. This first template covers parts that are explicitly identified using an href attribute
Namespace No namespace
Match eb3:PartInfo[starts-with(@href,'cid:')]
Mode #default
Import precedence 0
Source
<xsl:template match="eb3:PartInfo[starts-with(@href,'cid:')]">
  <ebbp:MessagePartNRInformation>
    <ebbp:MessagePartIdentifier>
      <xsl:value-of select="substring-after(@href,'cid:')"/>
    </ebbp:MessagePartIdentifier>
  </ebbp:MessagePartNRInformation>
</xsl:template>
[ top ]
Template eb3:PartInfo[not(starts-with(@href,'cid:'))]
Namespace No namespace
Match eb3:PartInfo[not(starts-with(@href,'cid:'))]
Mode #default
Import precedence 0
Source
<xsl:template match="eb3:PartInfo[not(starts-with(@href,'cid:'))]">
  <ebbp:MessagePartNRInformation>
    <ebbp:MessagePartIdentifier>
      <xsl:value-of select="@href"/>
    </ebbp:MessagePartIdentifier>
  </ebbp:MessagePartNRInformation>
</xsl:template>
[ top ]
Template eb3:PartInfo[not(@href)]
Documentation

Description

There are two templates for eb3:PartInfo elements. This second template covers parts with an omitted href attribute, which implicitly references a business document in the SOAP payload. The receipt implicitly reference this payload.

Namespace No namespace
Match eb3:PartInfo[not(@href)]
Mode #default
Import precedence 0
Source
<xsl:template match="eb3:PartInfo[not(@href)]"/>
[ top ]
Parameter messageid
Namespace No namespace
Used by
Template
Source
<xsl:param name="messageid">someuniqueid@receiver.example.com</xsl:param>
[ top ]
Parameter timestamp
Namespace No namespace
Used by
Template
Source
<xsl:param name="timestamp">2011-12-13T19:43:11.735Z</xsl:param>
[ top ]
Parameter start
Namespace No namespace
Used by
Template
Source
<xsl:param name="start">None</xsl:param>
[ top ]
Output (default)
Namespace No namespace
Output properties
method indent
xml yes
Source
<xsl:output method="xml" indent="yes"/>
[ top ]