Web Servis İçerisinde Gelen Mesajların Sıralanması

Web Servis İçerisinde Gelen Mesajların Sıralanması


    Selamlar, inbound web service ile gelen mesajları kimi zaman sıralı işlememiz gerekebilir. Bu tür durumlarda sıralama işini custom BS ile yapmak zorlu ve hatalara müsait bir çözüm olabiliyor. Bu sebeple XSLT çözümünden bahsedeceğim. 


    XSLT ile gelen mesaj üzerinde bir çok değişiklik yapılabilir. Bu sebeple XSLT'yi ayrıca araştırmanızı tavsiye ederim (bir önceki yayınladığım "Web Servis Mesajında Boş Tag'leri Silme" başlıklı konuda da mesaj içerisindeki boş tag'leri silmek için kullanmıştık)

 Gelelim sıralama çözümümüze. Burada yapmamız gereken şey WF'umuza sadece 2 step eklemek.



Step1: Prepare xslt

Business Service Name: Workflow Utilities

Business Service Method : Echo


Output Argument


XSLT: (aşağıdaki gibi tek satır olmalı)
<?xml version="1.0" encoding="UTF-16"?><xsl:stylesheet version="1.0" xmlns:xsl="hxxp://www.w3.org/1999/XSL/Transform" xmlns:xx="IO_NAMESPACE"                ><xsl:output indent="yes" /><xsl:strip-space elements="*"/><xsl:template match="text()[not(string-length(normalize-space()))]"/><xsl:template match="/*/*/*"><xsl:copy><xsl:apply-templates select="@ListOfEntity" /><xsl:apply-templates><xsl:sort select="xx:EntityStatus" order="ascending"/><xsl:sort select="xx:ParentEntityNumber" order="ascending"/></xsl:apply-templates></xsl:copy></xsl:template><xsl:template match="@*|node()"><xsl:copy><xsl:apply-templates select="@*|node()"/></xsl:copy></xsl:template></xsl:stylesheet>

<?xml version="1.0" encoding="UTF-16"?>
<xsl:stylesheet version="1.0" xmlns:xsl="hxxp://www.w3.org/1999/XSL/Transform" xmlns:xx="IO_NAMESPACE">
<xsl:output indent="yes" />
<xsl:strip-space elements="*"/>
<xsl:template match="text()[not(string-length(normalize-space()))]"/>
<xsl:template match="/*/*/*">
<xsl:copy>
<xsl:apply-templates select="@ListOfEntity" />   ----> sıralanacak entity'nin XML container Element değeri
<xsl:apply-templates>
<xsl:sort select="xx:EntityStatus" order="ascending"/> -----> Sort specification
<xsl:sort select="xx:ParentEntityNumber" order="ascending"/> -----> Sort specification
</xsl:apply-templates>
</xsl:copy>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>


Step1: Transform

Business Service Name: EAI XSLT Service

Business Service Method : Transform


Input Argument




Output Argument






Arık mesajınız belirlediğiniz kriterlere göre sıralı bir şekilde düzenlendi.



Yorumlar

Bu blogdaki popüler yayınlar

Siebel OpenUI Presentation Model ve Physical Renderer Yapısı

Long running query'ler için Query Plan fixleme

Profile Attribute Listesi