How to Set Up Processing for Inbound Messages with XML Content

Inbound Message XML allows you to send arbitrary XML data to Oracle Transportation Management and have the system transform it to XML formats which Oracle Transportation Management can handle. When sending in Message XML, Oracle Transportation Management can:

  • Create a Transmission XML from the Message XML using a Stylesheet Profile.
  • Create a Message Center Notification from the Message XML using a Stylesheet Profile.

If there is a need to populate the header fields in the Message Hub Manager with data parsed from the Message XML, another Stylesheet Profile can be defined to perform this functionality.

Sample Message XML with Arbitrary XML Data

Following is an example of a Message XML with arbitrary XML content which will be referred to in subsequent steps.

<msg:Message xmlns:msg="http://xmlns.oracle.com/apps/otm/msg/v1" schemaVersion="1.0">

<MessageHeader>...</MessageHeader>

<msg:XMLContent>

<tran xmlns="" ID = "6302" companyID = "MYCOMPANY" auxID = "0043032896">

<T.2.RM14.0>

<eventTS>2010-04-09T22:09:20Z</eventTS>

<equipment ID = "C31872" equipType = "tractor" unitAddress = "0105302263" mobileType = "4"/>

<driverID>QUEST01</driverID>

<position lon = "-88.108055555" lat = "44.472222222" posTS = "2010-04-09T22:09:15Z"/>

<proximity postal = "54301" country = "US" stateProv = "WI" city = "Green Bay" direction = " SW" distance = "5.18" placeType = "CITY"/>

<proximity postal = "54115" country = "US" stateProv = "WI" city = "De Pere" direction = " NW" distance = "2.85" placeType = "TOWN"/>

<posType>3</posType>

<ignitionStatus>1</ignitionStatus>

<tripStatus>O</tripStatus>

<GMH>6411</GMH>

<receivedTS>2010-04-09T22:09:28Z</receivedTS>

<msgPriority>0</msgPriority>

<macroBody>

<macroType direction = "R" number = "14" version = "2">Tractor PU/DP</macroType>

<macroField dictTag = "puDpPower">PICKUP</macroField>

<macroField dictTag = "locationID">1234567890</macroField>

</macroBody>

</T.2.RM14.0>

</tran>

</msg:XMLContent>

</msg:Message>

Create Transmission XML from Message XML

  1. Below is a sample XSL to produce a ShipmentStatus: 

    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="tran">
    <Transmission xmlns="http://xmlns.oracle.com/apps/otm">
    <TransmissionHeader>
    <UserName>MYDOMAIN.ADMIN</UserName>
    <Password>MYPASSWD</Password>
    </TransmissionHeader>
    <TransmissionBody>
    <GLogXMLElement>
       <ShipmentStatus>
          <PowerUnitGid>
             <Gid>
                <DomainName>MYDOMAIN</DomainName>
                <Xid><xsl:value-of select="./T.5.01.0/equipment/@ID"/></Xid>
             </Gid>
          </PowerUnitGid>
          <DriverGid>
             <Gid>
                <DomainName>MYDOMAIN</DomainName>
                <Xid><xsl:value-of select="./T.5.01.0/driverID"/></Xid>
             </Gid>
          </DriverGid>
          <ResponsiblePartyGid>
             <Gid>
                <Xid>CARRIER</Xid>
             </Gid>
          </ResponsiblePartyGid>
          <StatusCodeGid>
             <Gid>
                <Xid>X3</Xid>
             </Gid>
          </StatusCodeGid>
          <EventDt>
             <GLogDate>
                <xsl:call-template name="convertDate">
                   <xsl:with-param name="tranDate" select="./T.5.01.0/eventTS"/>
                </xsl:call-template>
                <xsl:call-template name="convertTime">
                   <xsl:with-param name="tranDate" select="./T.5.01.0/eventTS"/>
                </xsl:call-template>
             </GLogDate>
          </EventDt>
          <StatusReasonCodeGid>
             <Gid>
                <Xid>AZ</Xid>
             </Gid>
          </StatusReasonCodeGid>
          <QuickCodeGid>
             <Gid>>
                <Xid>BO</Xid>
             </Gid>
          </QuickCodeGid>
          <StatusGroup>
             <StatusGroupGid>
                <Gid>
                   <Xid>ARRIVED</Xid>
                </Gid>
             </StatusGroupGid>
          </StatusGroup>
          <ReasonGroup>
             <ReasonGroupGid>
                <Gid>
                   <Xid>CARRIER_RELATED</Xid>
                </Gid>
             </ReasonGroupGid>
          </ReasonGroup>
          <SSStop>
             <SSLocation>
                <LocationName><xsl:value-of select="./T.5.01.0/gsevent/@placeName"/></LocationName>
                <Latitude><xsl:value-of select="round(./T.5.01.0/position/@lat * 100000) div 100000"/></Latitude>
                <Longitude><xsl:value-of select="round(./T.5.01.0/position/@lon * 100000) div 100000"/></Longitude>
             </SSLocation>
          </SSStop>
          <EventRecdDt>20080305000000</EventRecdDt>
          <StatusLevel>SHIPMENT</StatusLevel>
       </ShipmentStatus>
    </GLogXMLElement>
    </TransmissionBody>
    </Transmission>
    </xsl:template>
    <xsl:template name="convertDate">
     <xsl:param name="tranDate" />
     <xsl:value-of select="substring($tranDate, 1, 4)"/>
     <xsl:value-of select="substring($tranDate, 6, 2)"/>
     <xsl:value-of select="substring($tranDate, 9, 2)"/>
    </xsl:template>
    <xsl:template name="convertTime">
     <xsl:param name="tranDate" />
     <xsl:value-of select="substring($tranDate, 12, 2)"/>
     <xsl:value-of select="substring($tranDate, 15, 2)"/>
     <xsl:value-of select="substring($tranDate, 18, 2)"/>
    </xsl:template>
    </xsl:stylesheet>
  2. Define a Stylesheet Profile for the XSL to create the Transmission.
    1. Specify the Stylesheet Profile ID.

    2. Specify the Template Name with the same value as the Stylesheet Profile ID.

    3. Select the Direction of "INBOUND".

    4. Select the Type of "XSL".

    5. Select the For Message XML check box.

    6. Create a Stylesheet Content ID using the sample transmission XML created above.

      1. Upload the sample XSL for the Transmission XML.
  3. Define a Message Type:
    1. Select a Message Direction of "INBOUND".

    2. Select the Generate Transmission XML option button.

    3. In the Result Stylesheet Profile field, select the stylesheet profile created for the Transmission XML.

  4. Specify the defined Message Type in the inbound Message XML.

Create a Message Center Notification

  1. Define an XSL file that will be used for generate a notification for the Message Center.
  2. Define a Stylesheet Profile for the XSL to the message center
    1. Specify the Stylesheet Profile ID.

    2. Specify the Template Name with the same value as the Stylesheet Profile ID.

    3. Select the Direction of "INBOUND".

    4. Select the Type of "XSL".

    5. Select the For Message XML check box.

    6. Create a Stylesheet Content ID using the sample transmission XML created above.

      1. Upload the sample XSL for the message center.
  3. Update the Message Type to use the XSL for the message center.
    1. Select "ALWAYS" in the Send To Message Center drop-down.

    2. Enter the Message Center User ID.
      OR

      Enter the Message Center Involved Party Qualifier.

    3. Enter the Message Center Stylesheet Profile ID to use for creating the Message Center entry.

Populate Message Hub Manager Fields from Arbitrary XML

If the data in the XMLContent needs to be extracted for use as arguments/variables in the Stylesheet Profile setup, then an XSL must be defined to parse the needed content. The XSL defined for this should produce a MsgArgs XML containing the argument names and values.

  1. To effectively extract arguments for use in the Stylesheet Profile, you define an XSL file which supports XPath expressions.
    1. From the example Message XML above, you can use the following XPath expressions to retrieve portions of data:

      1. For driver ID: tran/T.2.RM14.0/driverID
      2. For equipment ID: tran/T.2.RM14.0/equipment/@ID
      3. For location ZIP: tran/T.2.RM14.0/proximity[@placeType='TOWN']/@postal
    2. A sample XSL file achieving this would be as follows:
      <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
      <xsl:template match="tran">
      <xsl:element name="MsgArgs">
      <xsl:element name="Arg">
      <xsl:attribute name="name">DRIVER_ID</xsl:attribute>
      <xsl:value-of select="./T.2.RM14.0/driverID"/>
      </xsl:element>
      <xsl:element name="Arg">
      <xsl:attribute name="name">EQUIPMENT_ID</xsl:attribute>
      <xsl:value-of select="./T.2.RM14.0/equipment/@ID"/>
      </xsl:element>
      <xsl:element name="Arg">
      <xsl:attribute name="name">LOCATION_ZIP</xsl:attribute>
      <xsl:value-of select="./T.2.RM14.0/proximity[@placeType='TOWN']/@postal"/>
      </xsl:element>
      </xsl:element>
      </xsl:template>
      </xsl:stylesheet>

    3. The XSL defined should result in an XML file with a MsgArgs root XML element that conforms to the following:
      <MsgArgs>
      <Arg name="DRIVER_ID">QUEST01</Arg>
      <Arg name="EQUIPMENT_ID">C31872</Arg>
      <Arg name="LOCATION_ZIP">54115</Arg>
      </MsgArgs>

  2. Define a Stylesheet Profile for each sample message:
    1. Specify the Stylesheet Profile ID.

    2. Specify the Template Name with the same value as the Stylesheet Profile ID.

    3. Specify the Direction of "INBOUND".

    4. Specify the Type of "XSL".

    5. Select the For Message XML check box.

    6. Create a Stylesheet Content ID using the sample message created above.

      1. Upload the XSL defined.
    7. Set stylesheet profile arguments:

      1. Manually define the arguments that have been specified in the XSL file (e.g. DRIVER_ID, EQUIPMENT_ID, LOCATION_ZIP, etc.)
      2. Add any additional Arguments needed for processing with default values.
      3. Specify arguments that are Required to proceed with processing.
    8. Set the Stylesheet Profile Set Fields:

      1. Select the Field Name to update.
      2. Select the Argument Name.
      3. Select the Assign Type as "ARG".
        OR

        Enter a Message Code Map ID. It represents the lookup table.
  3. For each inbound Message, specify the Stylesheet Profile GID in the Message XML to be the Stylesheet Profile defined.

Related Topics