praveen requirement

 




6th may 24


----


SuministroLRFacturasEmitidasType

SuministroLRFacturasRecibidasType

SuministroLRBienesInversionType

SuministroLRDetOperacionIntracomunitariaType

SuministroLRCobrosMetalicoType

SuministroLROperacionesSegurosType

SuministroLRAgenciasViajesType

SuministroLRInmueblesAdicionalesType

SuministroLRVentaBienesConsignaType

SuministroLRCobrosEmitidasType

SuministroLRPagosRecibidasType

BajaLRFacturasEmitidasType

BajaLRFacturasRecibidasType

BajaLRBienesInversionType

BajaLRDetOperacionIntracomunitariaType

BajaLRCobrosMetalicoType

BajaLROperacionesSegurosType

BajaLRAgenciasViajesType

BajaLRInmueblesAdicionalesType

BajaLRVentaBienesConsignaType




import com.sap.gateway.ip.core.customdev.util.Message

import java.util.HashMap

import java.text.SimpleDateFormat

import java.util.Date


def Message processData(Message message) {

    // Get the XML payload from the message

    def xmlPayload = message.getBody(java.lang.String) as String


    // Replace namespace prefixes

    xmlPayload = xmlPayload.replaceAll("n1:", "siiLR:")

    xmlPayload = xmlPayload.replaceAll("n0:", "sii:")


    // Define a map of replacement patterns for different keywords

    def keywordReplacements = [

        'SuministroLRFacturasRecibidasType': [

            start: '<SuministroLRFacturasRecibidasType.*?>',

            end: '</SuministroLRFacturasRecibidasType>',

            replacementStart: '<?xml version="1.0" encoding="UTF-8"?>\n<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:siiLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd" xmlns:sii="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd">\n\t<soapenv:Body>',

            replacementEnd: '</soapenv:Body>\n</soapenv:Envelope>'

        ],

        'SuministroLRFacturasEmitidasType': [

            start: '<SuministroLRFacturasEmitidasType.*?>',

            end: '</SuministroLRFacturasEmitidasType>',

            replacementStart: '<?xml version="1.0" encoding="UTF-8"?>\n<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:siiLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd" xmlns:sii="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd">\n\t<soapenv:Body>',

            replacementEnd: '</soapenv:Body>\n</soapenv:Envelope>'

        ],

        'SuministroLRBienesInversionType': [

            start: '<SuministroLRBienesInversionType.*?>',

            end: '</SuministroLRBienesInversionType>',

            replacementStart: '<?xml version="1.0" encoding="UTF-8"?>\n<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:siiLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd" xmlns:sii="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd">\n\t<soapenv:Body>',

            replacementEnd: '</soapenv:Body>\n</soapenv:Envelope>'

        ],

        // Add other keywords and their replacements as needed

        'BajaLRFacturasEmitidasType': [

            start: '<BajaLRFacturasEmitidasType.*?>',

            end: '</BajaLRFacturasEmitidasType>',

            replacementStart: '<?xml version="1.0" encoding="UTF-8"?>\n<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:siiLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd" xmlns:sii="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd">\n\t<soapenv:Body>',

            replacementEnd: '</soapenv:Body>\n</soapenv:Envelope>'

        ],

        'BajaLRFacturasRecibidasType': [

            start: '<BajaLRFacturasRecibidasType.*?>',

            end: '</BajaLRFacturasRecibidasType>',

            replacementStart: '<?xml version="1.0" encoding="UTF-8"?>\n<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:siiLR="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroLR.xsd" xmlns:sii="https://www2.agenciatributaria.gob.es/static_files/common/internet/dep/aplicaciones/es/aeat/ssii/fact/ws/SuministroInformacion.xsd">\n\t<soapenv:Body>',

            replacementEnd: '</soapenv:Body>\n</soapenv:Envelope>'

        ],

        // Add other keywords and their replacements as needed

    ]


    // Iterate over the keyword replacements map and perform replacements

    keywordReplacements.each { keyword, replacementInfo ->

        xmlPayload = xmlPayload.replaceAll(replacementInfo.start, replacementInfo.replacementStart)

        xmlPayload = xmlPayload.replaceAll(replacementInfo.end, replacementInfo.replacementEnd)

    }


    // Set the modified XML payload back to the message

    message.setBody(xmlPayload)


    return message

}


Popular posts from this blog

pss book : శ్రీకృష్ణుడు దేవుడా, భగవంతుడా completed , second review needed. 26th April 2024

pss book: గురు ప్రార్థనామంజరి . completed 21st july 2024

pss book: కధల జ్ఞానము read review pending. 25th june 2024