Created
July 20, 2020 19:11
-
-
Save EvgenJin/7ea26d09d57e9f87bba9280601d0f582 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#parsing xml | |
ru.gpb.mule.util.Utils.makeString(payload) | |
def response = new XmlSlurper().parseText(payload) | |
def reestr = new XmlSlurper().parseText(response as String) | |
def code = reestr.CreditRequest.@Code | |
println(reestr.CreditRequest.@Code) | |
return response | |
#create json | |
def ob = [:]; | |
ob.name = "obj_name_xml" | |
def jsonObj = new groovy.json.JsonBuilder(ob); | |
#flowVars | |
flowVars['ob'] = jsonObj | |
#парсинг json в модель | |
flowVars["documentModel"] = new JsonSlurper().parse(new File(this.getClass().getClassLoader().getResource("documentModel.json").getFile())) | |
#создать папку | |
def tmpFolderPath = flowVars["dirPath"] | |
flowVars["tmpFolderPath"] = tmpFolderPath | |
log.info("path = " + tmpFolderPath) | |
def src = new File(tmpFolderPath); | |
if (!src.exists()){ | |
def mkdir = src.mkdirs() | |
if (!mkdir){ | |
throw new Exception("Неудалось создать папку") | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment