Skip to content



Build and send (or receive) RNIF envelopes that contain one of the following PIDX payloads:

  • Invoice
  • InvoiceResponse
  • FieldTicket
  • FieldTicketResponse
  • Quote
  • QuoteNotification
  • QuoteRequest
  • OrderChange
  • OrderCreate
  • OrderResponse
  • Receipt Acknowledgment
  • Quote
  • Exception



Binding name: p6.pidxrnif

Method: Tuple4 postAndWaitResponse( final String xmlConf, final Map< String, String > parameters, final CloseableHttpClient httpClient, final HttpPost postMethod )

Using the supplied XML configuration metadata (see below) and a Map of optional parameters, an RNIF payload is constructed and POSTed to a trading partner using the supplied httpClient and postMethod.

The httpClient and postMethod are from the Apache Http Components API. The httpClient is best built using the securesocket DSL.

The POST response is received and parsed. The Tuple4 object returned contains the following:

  • Http Status Code
  • Http Response Message
  • Http Response Entity
  • The Content-Type of the Response Entity

Method: void sendMessageToStream( final String xmlConf, final OutputStream os, final Map< String, String > parameters )

A component method of the postAndWaitResponse(). Using the supplied XML configuration metadata (see below) and a Map of optional parameters, an RNIF payload is constructed and written to the supplied OutputStream.

Method: Tuple4 readResponseFromStream( int responseCode, String responseMessage, Map< String, String > headers, InputStream is )

A component method of the postAndWaitResponse(). Given the components of an Http Response, build the standard Tuple4 response structure.

Method: Tuple2< String, String > receive( Map< String, String > headers, InputStream is, final Closure partClosure )

Method: Tuple2< String, String > receive( Map< String, String > headers, byte[] ba, final Closure partClosure )

Trading Partners send RNIF messages to a URL configured using the routes service and p6rest component via an HTTPS POST request. Neither HTTP nor GET requests are advisable. The POST headers and POST entity should be supplied as Map and byte[]/InputStream arguments respectively. HTTPS is not supported directly via the Platform 6 instance. An inbound HTTP(S) proxy is required for this such as NGINX or Apached.

Files (the content + the attachments) will be detached to the p6 temporary folder (e.g /opt/ Each time an RNIF Message is processed the given closure will be called with the following arguments:

  • Message Concept
  • Message Content as XML

The Tuple2 object returned contains:

  • Content-Type of Response Message
  • Response message

RNIF Message Metadata

Typically created via an XSLT using a Transaction document such as a TransactionInfo:

<xsl:stylesheet xmlns:xsl="" version="1.0" exclude-result-prefixes="#all"> 
    <xsl:output method="xml" omit-xml-declaration="no"/> 

    <xsl:param name="TIMESTAMP"/>
    <xsl:param name="CONTEXTID"/>

    <xsl:variable name="uri"><xsl:value-of select="/TransactionInfo/CurrentDocumentURI"/></xsl:variable>   
    <xsl:variable name="SenderDUNS"><xsl:value-of select="/TransactionInfo/KeyValue[Key='SenderDUNS']/Value"/></xsl:variable>
    <xsl:variable name="SenderLocationID"><xsl:value-of select="/TransactionInfo/KeyValue[Key='SenderLocationID']/Value"/></xsl:variable> 
    <xsl:variable name="ReceiverDUNS"><xsl:value-of select="/TransactionInfo/KeyValue[Key='ReceiverDUNS']/Value"/></xsl:variable>   
    <xsl:variable name="ReceiverLocationID"><xsl:value-of select="/TransactionInfo/KeyValue[Key='ReceiverLocationID']/Value"/></xsl:variable>   
    <xsl:variable name="MessageID"><xsl:value-of select="/TransactionInfo/Id"/></xsl:variable>   
    <xsl:variable name="BusinessDocName"><xsl:value-of select="/TransactionInfo/BusinessDocName"/></xsl:variable>   

    <xsl:template match="/">
                <ReceiverDUNS><xsl:value-of select="$ReceiverDUNS"/></ReceiverDUNS>
                <ReceiverLocationID><xsl:value-of select="$ReceiverLocationID"/></ReceiverLocationID>
                <SenderDUNS><xsl:value-of select="$SenderDUNS"/></SenderDUNS>
                <SenderLocationID><xsl:value-of select="$SenderLocationID"/></SenderLocationID>
                <MessageTrackingID><xsl:value-of select="$MessageID"/></MessageTrackingID>
                     <xsl:when test="$BusinessDocName = 'Quote'"><xsl:value-of select="concat('JDE_QPR_.',$MessageID)"/></xsl:when>
                     <xsl:otherwise><xsl:value-of select="$MessageID"/></xsl:otherwise>
                    <xsl:when test="$BusinessDocName = 'Invoice'">Invoice</xsl:when>
                    <xsl:when test="$BusinessDocName = 'InvoiceResponse'">InvoiceResponse</xsl:when>
                    <xsl:when test="$BusinessDocName = 'Field Ticket'">FieldTicket</xsl:when>
                    <xsl:when test="$BusinessDocName = 'FT Response'">FieldTicketResponse</xsl:when>
                    <xsl:otherwise><xsl:value-of select="$BusinessDocName"/></xsl:otherwise>

                <URI><xsl:value-of select="$uri"/></URI>

                <!-- <IgnoreMissingAttachment>false</IgnoreMissingAttachment> -->
                <xsl:apply-templates select="//Attachment"/>

    <xsl:template match="Attachment">
            <ContentID>Attachment<xsl:value-of select="position()"/></ContentID>
            <MimeType><xsl:value-of select="ContentType"/></MimeType>
            <URI><xsl:value-of select="URI"/></URI>

Some additional parameters can be passed to the DSL via a Map which will provide default values when they are not available in the Metadata XML:

XPath Description
/RnifMessage/MetaData/ReceiverDUNS The receiver DUNS number
/RnifMessage/MetaData/ReceiverLocationID The receiver Location Id parameter
/RnifMessage/MetaData/SenderDUNS The sender DUNS number
/RnifMessage/MetaData/SenderLocationID The sender Location Id parameter
/RnifMessage/MetaData/MessageTrackingID The RNIF unique Message Tracking ID
/RnifMessage/MetaData/PipInstanceIdentifier The RNIF PIP Instance Identifier
/RnifMessage/MetaData/Concept The document Type Invoice, ReceiptAcknowledgment, Quote, etc…
/RnifMessage/MetaData/GlobalUsageCode The RNIF Global usage code; usually Test or Production
/RnifMessage/Content/URI The URI to the XML file with the content. The file MUST be UTF-8 encoded.
/RnifMessage/Content/TransferEncoding The Content-Transfer-Encoding to set on the Mime Part holding the content, defaults to binary when not specified
/RnifMessage/Attachments/IgnoreMissingAttachment If set to true and an attachment file cannot be found at the URI specified in the Metadata XML, the attachment will be ignored and not sent
/RnifMessage/Attachments/SendEmptyAttachment If set to true and an attachment file is found at the URI specified in the Metadata XML but is empty, the attachment is sent. Otherwise an error is raised.
/RnifMessage/Attachments/Content Optional and can be repeated
/RnifMessage/Attachments/Content/ContentID The content ID header
/RnifMessage/Attachments/Content/Description The description of the attachment, optional
/RnifMessage/Attachments/Content/MimeType The mime type (with charset when appropriate) of the part
/RnifMessage/Attachments/Content/URI The URI of the attachment
/RnifMessage/Attachments/Content/TransferEncoding The Content-Transfer-Encoding to set on the Mime Part holding the content. Defaults to binary when not specified

Example Rnif Metadata XML

<?xml version="1.0" encoding="UTF-8"?>
        <MessageTrackingID>065485625|P21|TP_CVX_PIDX_352438_INVOIC_94973051_200712191107049|Invoice|Invoice Notification</MessageTrackingID>


            <Description>Field Ticket</Description>


import org.apache.http.client.methods.HttpPost
import org.apache.http.client.config.RequestConfig

// Sixty second timeout
def timeout = 60

// Use Xslt to build configuration meta data from input transaction
def xmlRnifConfig = p6.xslt.process( "RnifMessage", p6.resource.get('RnifMessage'), p6.transaction )

// A few parameter overrides for this script
def parameters = [
    'globalUsageCode': 'Test',
    'ignoreMissingAttachment': 'false'

def config = RequestConfig.custom()
    .setConnectTimeout( timeout * 1000 )
    .setConnectionRequestTimeout( timeout * 1000 )
    .setSocketTimeout( timeout * 1000 )

// TWO_WAY TLS is a common requirement of RNIF POSTs
def ctx = p6.securesocket.contextBuilder()
    .setType( SecureContext.BundleType.TWO_WAY_TRUST_ANY )
    .setIdentityPrivateKeyPath( "file://${P6_DATA}/resources/certificates/privatekey.pem" )
    .setIdentityCertsPaths( "file://${P6_DATA}/resources/certificates/publickey.pem" )

// Further customise our httpClient builder
def clientBuilder = p6.securesocket.clientBuilder( ctx )
    .setDefaultRequestConfig( config )

// Auto-close 'with' block { client ->
    def tpl = p6.pidxrnif.postAndWaitResponse( xmlRnifConfig, parameters, client, new HttpPost( "" ) )

    // Extract the response from teh Tuple4
    def responseStatus = tpl.first
    def responseReason = tpl.second
    def responseMessage = tpl.third
    def responseMessageContentType = tpl.fourth

    assert responseStatus == 200   

Inbound POST Route


Once the route is deployed, a POST test can be made to: https://localhost:8443/p6/public/rnif/receive or alternatively to an NGINX mapped destination (recommended)

Script: RNIFInbound

def tpl = p6.pidxrnif.receive( p6.pipeline.toStringMap(), p6.pipeline.getBytes('body'), { concept, xml ->
    println '++++++ Got RNIF Part!  Concept: ' + concept + '\nXml: ' + xml

// Build the Http POST response into the pipeline
p6.pipeline.put("Content-Type", tpl.first)
p6.pipeline.put("body", tpl.second, tpl.first)
p6.pipeline.put("CamelHttpResponseCode", (tpl.second=='OK') ? '200' : '500')