Service variables to set

The document routing preprocessor is to set routing service variables that specify information about the from and to partners.

Slash notation - var://service/b2b-partner-from
Dot notation - serviceVars.b2bPartnerFrom
Business ID for the from partner. The value is generated for the From:, AS2-From:, or AS3-From: header of AS outbound messages, or the eb:From or eb:PartyId header of ebMS outbound messages. To route non-AS and non-ebMS binary messages, set this value with the document routing preprocessor file.
Slash notation - var://service/b2b-partner-to
Dot notation - serviceVars.b2bPartnerTo
Business ID for the to partner. The value is generated for the To:, AS2-To:, or AS3-To: header of AS outbound messages, or the eb:To or eb:PartyId header of ebMS outbound message. To route non-AS and non-ebMS binary messages, set this value with the document routing preprocessor file.
Slash notation - var://service/b2b-doc-type
Dot notation - serviceVars.b2bDocType
Document type of the message body. The value can be x12, edifact, xml, or binary in the document routing preprocessor file. If you do not set the value, the DataPower® Gateway automatically detects the document type.
If the document routing preprocessor file does not set the document type variable, the DataPower Gateway uses the HTTP Content-Type header. When not available, the DataPower Gateway attempts to parse the message as XML, X12, and EDIFACT, and XML before the document is classified as binary.
  • If the message is parsed successfully as XML, X12, or EDIFACT, the gateway uses the information in the message to find identifiers of the sending and receiving partners and routes the message.
  • If the document type is binary, you must use the stylesheet or GatewayScript to set the b2b-partner-from and b2b-partner-to variables, or, the binary messages are rejected.

The following code fragments indicate that all outbound messages come from the partner ME and are routed to one of several other partner identifiers based on the queue name.

Stylesheet
<dp:set-variable name="'var://service/b2b-partner-from'" value="'ME'"/>
<xsl:choose>
  <xsl:when test="$queue = 'YOUQ'">
    <dp:set-variable name="'var://service/b2b-partner-to'" value="'YOU'"/>
  </xsl:when>
  <xsl:when test="$queue = 'THEMQ'">
    <dp:set-variable name="'var://service/b2b-partner-to'" value="'THEM'"/>
  </xsl:when>
  <xsl:when test="$queue != ''">
    <dp:set-variable name="'var://service/b2b-partner-to'" value="$queue"/>
  </xsl:when>
  <xsl:otherwise>
    <!-- Do nothing; get receiving partner from message if possible -->
  </xsl:otherwise>
</xsl:choose>
GatewayScript
serviceVars.setVar('var://service/b2b-partner-from', 'ME');
switch (queue) {
case 'YOUQ':
serviceVars.setVar('var://service/b2b-partner-to', 'YOU');
break;
case 'THEMQ:
serviceVars.setVar('var://service/b2b-partner-to', 'THEM');
break;
default:
if (queue) {
serviceVars.setVar('var://service/b2b-partner-to', queue);
} else {
// Do nothing; get receiving partner from message if possible
}
break;
}