Internal XSLT Sender

The Automated Task editor internal XSLT automator receives task data from OSM and sends data to an external system. You can send a message to an external system using whatever protocol that system requires, such as, Telnet, HTTP, CORBA, SOAP, or web services.

The XSLT has the following characteristics:

  • XSLT context: The input document for any automated task automation plug-in is the order data defined in the Automation Task editor Task Data tab. You can access this data by declaring the TaskContext OSM Java class. Always declare this class along with the context java variable. For example:

    xmlns:context="java:com.mslv.oms.automation.TaskContext"
    ...
    <xsl:param name="context"/>
    
  • Initial namespace declarations: You must declare ScriptSenderContextInvocation in any internal XSLT automator which extends ScriptReceiverContextInvocation. Always declare this class along with the automator java variable. For example:

    xmlns:automator="java:oracle.communications.ordermanagement.automation.plugin.ScriptSenderContextInvocation"
    ...
    <xsl:param name="automator"/>
    

    Oracle recommends that you use the standard Apache log class. Always declare this class along with the log java variable.

    xmlns:log="java:org.apache.commons.logging.Log"
    ...
    <xsl:param name="log"/>
    

    You must use the TextMessage class for sending JMS based messages. Always declare this class along with the outboundMessage Java variable. You can use JMS text based messages to send OSM Web Service messages to other OSM systems, such as a service order from an OSM COM system to an OSM SOM system.

    xmlns:outboundMessage="java:javax.jms.TextMessage"
    ...
    <xsl:param name="outboundMessage"/>
    

    Note:

    If you need to support any other protocol for sending messages, you can implement a custom Java automation plug-in for the protocol or import a helper function implementation that supports the protocol.

  • Body: The body for an internal XSLT sender can contain the following elements:

    • Use outboundMessage to set up the standard WebLogic JMS message properties for web services:

      <xsl:variable name="outboundMessage" select="java:setStringProperty($outboundMessage, '_wls_mimehdrContent_Type', 'text/xml; charset=&quot;utf-8&quot;')"/>
      
    • Use outboundMessage to set up the OSM Web Service URI JMS message property:

      <xsl:variable name="outboundMessage" select="java:setStringProperty($outboundMessage, 'URI', '/osm/wsapi')"/>
      
    • You can optionally use outboundMessage with the XML API to populate a JMS property value from order data. For example this code sets up an Ora_OSM_COM_OrderId parameter that is populated with the OSM order ID:

      <xsl:variable name="outboundMessage" select="java:setStringProperty($outboundMessage, 'Ora_OSM_COM_OrderId', /oms:GetOrder.Response/oms:OrderID)"/>
      
    • You can optionally use outboundMessage to set the JMS Correlation ID for the automation task before sending the message. This allows OSM to route a return message with the same corresponding JMS property value to an external XQuery automator on the same automation task as the original sender automation plug-in. For example, the following code sets the JMS correlation ID using the original OSM COM order:

      <xsl:variable name="void" select="java:setJMSCorrelationID($outboundMessage, concat($order/oms:_root/oms:messageXmlData/ebo:ProcessSalesOrderFulfillmentEBM/ebo:DataArea/ebo:ProcessSalesOrderFulfillment/corecom:Identification/corecom:ID/text(),'-COM'))"/>
      

      If this code were applied to "Message Example", the return value would be a concatenation of ScenarioA2 and -COM: ScenarioA2-COM.

      Note:

      Other correlation scenarios are possible. For example, you may send a message from automation task without expecting any response to the same automation task. In this scenario, another automation task further down in the process may be dedicated to receiving the response message, in which case an automation plug-in would be required that would set the correlation ID expected from the return message for that automated task. See the chapter about using automation in OSM Developer's Guide for more information about asynchronous communication scenarios.

    • Access to the task level order data (the task view) using the XML API GetOrder.Response function call. For example, the following code provides access to all order data passed into the task as a variable that is then used in other variables to access different parts of the data:

          <xsl:template match="/">
              <xsl:variable name="order" select="oms:GetOrder.Response"/>
              <xsl:variable name="othervariable" select="$order/oms:_root/oms:orderid"/>
      
    • Any XSLT logic your plug-in requires, such as if-then or if-then-else statements that evaluate based on one or more parameters within the response message. For example, there could be a choice of two or more messages that could be sent depending on the order data values, or you might log a message.

    • A completeTaskOnExit method statement that completes the plug-in and transitions the task to the next task based on the status selected if the plug-in is intended to end the task. Typically, an automated task would contain an internal XSLT sender plug-in for sending a message and an external XSLT receiver plug-in for receiving a message, but you can also create an automation that only sends an order with another automation that receives the order. This can be useful if the response message takes a long time to return. If you are expecting the system to respond that you sent the message to, you must configure the internal XSLT sender with a reply to queue that listens for a message acknowledgement, whether the response is returned to an external automator on the same automation task or on another automation task.

The following example provides the code for an XSLT that sends a message from an OSM system in the COM role to an OSM system in the SOM role using the OSM Web Service interface and assumes JMS communication over T3S.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns="http://www.metasolv.com/OMS/OrderDataUpdate"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:java="http://xml.apache.org/xslt/java" 
    xmlns:xalan="http://xml.apache.org/xslt"
    xmlns:oms="urn:com:metasolv:oms:xmlapi:1" 
xmlns:automator="java:oracle.communications.ordermanagement.automation.plugin.ScriptSenderContextInvocation"
    xmlns:context="java:com.mslv.oms.automation.TaskContext"
    xmlns:log="java:org.apache.commons.logging.Log"
    xmlns:outboundMessage="java:javax.jms.TextMessage"
    xmlns:to="http://TechnicalOrder"
    xmlns:provord="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1"
    xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2"
    xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
    xmlns:ebo="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/SalesOrder/V2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    exclude-result-prefixes="xsl java xalan oms com ser soapenv xsi"
    xmlns:fn="http://www.w3.org/2005/02/xpath-functions">

    <!-- * -->
    <xsl:param name="automator"/>
    <xsl:param name="log"/>
    <xsl:param name="context"/>
    <xsl:param name="outboundMessage"/>
 
    <!-- * -->

    <xsl:output method="xml" indent="yes" omit-xml-declaration="no" xalan:indent-amount="5"/>
    <xsl:template match="/">
        <xsl:variable name="order" select="oms:GetOrder.Response"/>
        <xsl:variable name="technicalActions" select="$order/oms:_root/oms:TechnicalActions"/>
        <xsl:variable name="ebm" select="$order/oms:_root/oms:messageXmlData"/>
        <xsl:variable name="bi" select="$order/oms:_root/oms:CaptureInteractionResponse"/>
        <xsl:variable name="outboundMessage" select="java:setStringProperty($outboundMessage, '_wls_mimehdrContent_Type', 'text/xml; charset=&quot;utf-8&quot;')"/>
        <xsl:variable name="outboundMessage" select="java:setStringProperty($outboundMessage, 'URI', '/osm/wsapi')"/>
        <xsl:variable name="outboundMessage" select="java:setStringProperty($outboundMessage, 'Ora_OSM_COM_OrderId', /oms:GetOrder.Response/oms:OrderID)"/>
        <xsl:variable name="void" select="java:setJMSCorrelationID($outboundMessage, concat($order/oms:_root/oms:messageXmlData/ebo:ProcessSalesOrderFulfillmentEBM/ebo:DataArea/ebo:ProcessSalesOrderFulfillment/corecom:Identification/corecom:ID/text(),'-COM'))"/>
        <xsl:variable name="log" select=java:info($log,concat('Sending Service Order for COM order: ', $order/oms:OrderID))"/>
        <xsl:call-template name="sendSomOrder"/>
    </xsl:template>
    <!-- ==================================
         Create the SOAP message for the sendSomOrder call
         ==================================== -->
    <xsl:template name="sendSomOrder">

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ord="http://xmlns.oracle.com/communications/ordermanagement">
        <soapenv:Header>
        <wsse:Security xmlns:wsse = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" soapenv:mustUnderstand="1">
        <wsse:UsernameToken xmlns:wsu = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="UsernameToken-4799946">
        <wsse:Username>demo</wsse:Username>
        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">passw0rd</wsse:Password>
        </wsse:UsernameToken>
        </wsse:Security>
        </soapenv:Header>
   <soapenv:Body>
      <ord:CreateOrder>
                <ebo:ProcessProvisioningOrderEBM xmlns:ebo="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1">
<ebo:DataArea>
                             <corecom:Process xmlns="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1" xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2" xmlns:aia="http://www.oracle.com/XSL/Transform/java/oracle.apps.aia.core.xpath.AIAFunctions" xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions" xmlns:oms="urn:com:metasolv:oms:xmlapi:1" xmlns:provord="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1"/>
                             <provord:ProcessProvisioningOrder xmlns="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1" xmlns:aia="http://www.oracle.com/XSL/Transform/java/oracle.apps.aia.core.xpath.AIAFunctions" xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions" xmlns:oms="urn:com:metasolv:oms:xmlapi:1" xmlns:provord="http://xmlns.oracle.com/EnterpriseObjects/Core/EBO/ProvisioningOrder/V1">
                             <corecom:SalesOrderReference>
                                  <corecom:SalesOrderIdentification>
                                      {$order/oms:_root/oms:ServiceOrder/cord:Order/cord:CustomerDetails/cord:OrderNumber/corecom:Identification/*}
                                  </corecom:SalesOrderIdentification>
                             </corecom:SalesOrderReference>
                             <provord:RequestedDeliveryDateTime>2010-07-16T08:24:38Z </provord:RequestedDeliveryDateTime>
                             <provord:TypeCode>SALES ORDER</provord:TypeCode>
                             <provord:FulfillmentPriorityCode>5</provord:FulfillmentPriorityCode>
                             <provord:FulfillmentSuccessCode>DEFAULT </provord:FulfillmentSuccessCode>
                             <provord:FulfillmentModeCode>DELIVER</provord:FulfillmentModeCode>
                             <provord:ProcessingNumber/>
                             <provord:ProcessingTypeCode/>
                             <corecom:Status xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2">
                                 <corecom:Code>IN PROGRESS</corecom:Code>
                             </corecom:Status>
                             <corecom:BusinessUnitReference xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2">
                                 <corecom:BusinessUnitIdentification>
                                     <corecom:ID schemeID="ORGANIZATION_ID" schemeAgencyID="SEBL_01">0-R9NH</corecom:ID>
                                 </corecom:BusinessUnitIdentification>
                             </corecom:BusinessUnitReference>
                             {$order/oms:_root/oms:ServiceOrder/cord:Order/cord:CustomerDetails/cord:CustomerParty/corecom:CustomerPartyReference}
                             <corecom:ParentProvisioningOrderReference xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2">
                                 <corecom:ProvisioningOrderIdentification>
                                     <corecom:BusinessComponentID schemeID="SALESORDER_ID" schemeAgencyID="COMMON"/>
                                 </corecom:ProvisioningOrderIdentification>
                             </corecom:ParentProvisioningOrderReference>
                             {
                                 for $x in $order/oms:_root/oms:ServiceOrder/cord:Order/cord:ServiceOrderLine
                                 return
                                 <provord:ProvisioningOrderLine>
                                 <corecom:Identification xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2">
                                      <corecom:BusinessComponentID>{concat($x/@id,'')} </corecom:BusinessComponentID>
                                      <corecom:ID schemeID="SALESORDER_LINEID" schemeAgencyID="SEBL_01">{concat($x/@id,'')}</corecom:ID>
                                      <corecom:ApplicationObjectKey>
                                           <corecom:ID schemeID="SALESORDER_LINEID" schemeAgencyID="SEBL_01">{concat($x/@id,'')}</corecom:ID>
                                      </corecom:ApplicationObjectKey>
                                 </corecom:Identification>
                                 <provord:OrderQuantity>1</provord:OrderQuantity>
                                 <provord:ServiceActionCode>{$x/cord:Action/text()} </provord:ServiceActionCode>
                                 <provord:ServicePointCode/>
                                 <corecom:Status xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2">
                                     <corecom:Code>IN PROGRESS</corecom:Code>
                                 </corecom:Status>
                                 <corecom:ServiceAddress xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2">
                                      <corecom:Identification>
                                          <corecom:BusinessComponentID schemeAgencyID="COMMON" schemeID="CUSTOMERPARTY_ADDRESSID">2d323733323231313531313836313331</corecom:BusinessComponentID>
                                          <corecom:ApplicationObjectKey>
                                               <corecom:ID schemeAgencyID="SEBL_01" schemeID="CUSTOMERPARTY_ADDRESSID">88-2KKNH</corecom:ID>
                                          </corecom:ApplicationObjectKey>
                                      </corecom:Identification>
                                      <corecom:LineOne>{$x/cord:Address/cord:LineOne/text()} </corecom:LineOne>
                                      <corecom:CityName>{$x/cord:Address/cord:CityName/text()} </corecom:CityName>
                                      <corecom:StateName>{$x/cord:Address/cord:StateName/text()} </corecom:StateName>
                                      <corecom:ProvinceName>{$x/cord:Address/cord:ProvinceName/ text()}</corecom:ProvinceName>
                                      <corecom:CountryCode>{$x/cord:Address/cord:CountryCode /text()}</corecom:CountryCode>
                                      <corecom:PostalCode>{$x/cord:Address/cord:PostalCode /text()}</corecom:PostalCode>
                                 </corecom:ServiceAddress>
                                 <corecom:ItemReference xmlns:corecom="http://xmlns.oracle.com/EnterpriseObjects/Core/Common/V2">
                                 <corecom:ItemIdentification>
                                      <corecom:BusinessComponentID schemeAgencyID="COMMON" schemeID="ITEM_ITEMID"/>
                                      <corecom:ApplicationObjectKey>
                                          <corecom:ID schemeID="ITEM_ITEMID" schemeAgencyID="SEBL_01">{concat($x/cord:InstanceID/text(),'')}</corecom:ID>
                                      </corecom:ApplicationObjectKey>
                                      <corecom:AlternateObjectKey>
                                          <corecom:ContextID/>
                                      </corecom:AlternateObjectKey>
                                      <corecom:SupplierItemID/>
                                 </corecom:ItemIdentification>
                                 <corecom:Name>{concat($x/@name,'')}</corecom:Name>
                                     <corecom:ClassificationCode listID="PermittedTypeCode"></corecom:ClassificationCode>
                                     <corecom:ClassificationCode listID="BillingProductTypeCode"/>
                                     <corecom:ClassificationCode listID="FulfillmentItemCode">{concat($x/@name,'')}</corecom:ClassificationCode>
                                     <corecom:ServiceIndicator>false</corecom:ServiceIndicator>
                                     <corecom:TypeCode>SERVICE</corecom:TypeCode>
                                     <corecom:Description/>
                                     <corecom:SpecificationGroup>
                                         <corecom:Name>ExtensibleAttributes</corecom:Name>
                                         {
                                              for $y in $x/cord:Attribute
                                              return
                                              <corecom:Specification>
                                                  <corecom:ServiceActionCode> </corecom:ServiceActionCode>
                                                  <corecom:Name>{concat($y/@name,'')} </corecom:Name>
                                                  <corecom:DataTypeCode>Text</corecom:DataTypeCode>
                                                  <corecom:Value>{$y/cord:Value/cord:value/text()} </corecom:Value>
                                              </corecom:Specification>
                                         }
                                     </corecom:SpecificationGroup>
                                     <corecom:PrimaryClassificationCode>{concat($x/@name,'')} </corecom:PrimaryClassificationCode>
                                     <corecom:ServiceInstanceIndicator>true </corecom:ServiceInstanceIndicator>
                                 </corecom:ItemReference>
                                 <provord:ProvisioningOrderLineSpecificationGroup>
                                     <corecom:SpecificationGroup>
                                          <corecom:Name>ExtensibleAttributes</corecom:Name>
                                          <corecom:Specification>
                                               <corecom:Name>ParentSalesOrderLine</corecom:Name>
                                               <corecom:Value>{$x/cord:primaryMapping/text()} </corecom:Value>
                                          </corecom:Specification>
                                         {
                                              for $z in $x/cord:secondaryMapping
                                              return
                                              <corecom:Specification>
                                                  <corecom:Name>ParentSalesOrderLine</corecom:Name>
                                              <corecom:Value>{$z/text()}</corecom:Value>
                                              </corecom:Specification>
                                         }
                                     </corecom:SpecificationGroup>
                                 </provord:ProvisioningOrderLineSpecificationGroup>
                                 </provord:ProvisioningOrderLine>
                             }
                          </provord:ProcessProvisioningOrder>
                      </ebo:DataArea>
                 </ebo:ProcessProvisioningOrderEBM>
      </ord:CreateOrder>
   </soapenv:Body>
</soapenv:Envelope>
</xsl:template>
    <!-- * -->
    <xsl:template match="* | @* | text()">
        <!-- do nothing -->
        <xsl:apply-templates/>
    </xsl:template>
</xsl:stylesheet>