SXI Forum

A place to collect usefull tips, tricks and implementation strategies.

You are not logged in.

#1 21-11-2018 10:09:52

SeanR
Administrator
Registered: 20-11-2018
Posts: 148

LicAboutToExpire X-Notify xml defaults to localhost [SOLVED]

Hi

To send LicAboutToExpire X-Notify xmls (see below example)

<?xml version="1.0" encoding="UTF-8"?>
<XNotification xmlns="http://www.sxi.co.za/XMLSchema">
<XHeader>
<XPress>
<Destination>localhost</Destination>
</XPress>
</XHeader>
<NotificationGroup application="XPress/Station" name="LicAboutToExpire" />
<Message>License for X-Layer will expire on Sat Sep 13 00:00:00 CAT 2014, please contact a representitive soon</Message>
</XNotification>

to another server via XPress, do the following:

1. Copy the stylesheet below into a blank document and save it as LicAboutToExpire_change_dest.xsl

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.sxi.co.za/XMLSchema"  xmlns:sxi="http://www.sxi.co.za/XMLSchema">
<xsl:output indent="yes"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>

<xsl:template match="//sxi:Destination">
<xsl:element name="{local-name()}">
<!-- replacement destination inserted below -->
<xsl:value-of select="'NEW_DESTINATION_SERVER'"/>
</xsl:element>
</xsl:template>
</xsl:stylesheet>

2. Replace NEW_DESTINATION_SERVER in the stylesheet above with the IP address of the server you wish to send the notification to. Do not remove the single quotes!

3. Copy the stylesheet to the following directory: Program Files/Southern X Integrators/XPress/Dispatch/stylesheet

4. Open your Program Files/Southern X Integrators/XPress/Dispatch/xml/Initialisation.xml file and add the following: (Note: if you already have a ContentTransformations rule configured, you only need to copy the contents of the <Transformation> element below):

<ContentTransformations>
<Transformation sendOriginal="no" stylesheetPath="../stylesheet/LicAboutToExpire_change_dest.xsl">
<Condition xpath="/sxi:XNotification/sxi:NotificationGroup/@name" value="LicAboutToExpire"/>
</Transformation>
</ContentTransformations>

5. Save the XPress Dispatch Initialisation.xml file and restart the XPress Dispatch service and you are done.

Offline

#2 21-11-2018 10:13:41

SeanR
Administrator
Registered: 20-11-2018
Posts: 148

Re: LicAboutToExpire X-Notify xml defaults to localhost [SOLVED]

Added additional test to the stylesheet.


Added an additional test to the stylesheet to check that the request being dealt with is a LicAboutToExpire request, as there may be other requests that need to be processed on the localhost.

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.sxi.co.za/XMLSchema" xmlns:sxi="http://www.sxi.co.za/XMLSchema">
    <xsl:output indent="yes"/>

    <xsl:template match="@*|node()">
        <xsl:copy>
            <xsl:apply-templates select="@*|node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="//sxi:Destination">
        <xsl:element name="{local-name()}">
            <xsl:value-of select="//sxi:Destination"/>
            <xsl:if test="/sxi:XNotification/sxi:NotificationGroup[1]/@name = &#39;LicAboutToExpire&#39;">
                <!-- replacement destination inserted below -->
                <xsl:value-of select="'NEW_DESTINATION_SERVER'"/>
            </xsl:if>
        </xsl:element>
    </xsl:template>

</xsl:stylesheet>

Offline

Board footer

Powered by FluxBB