Documentation Index
Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
Use this file to discover all available pages before exploring further.
Groovy script ile XML mesajındaki bir node’un seviyesini değiştirme işlemi
Documentation Index
Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
Use this file to discover all available pages before exploring further.
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<soap:Fault>
<faultcode>
soap:Server
</faultcode>
<faultstring>
javax.xml.ws.WebServiceException: com.exception.BaseUserException: Some Error.
</faultstring>
</soap:Fault>
</soap:Body>
</soap:Envelope>
import groovy.xml.XmlSlurper
import groovy.xml.XmlUtil
var rootNode = new XmlSlurper(false, true).parseText(responseBodyTextFromTargetAPI).declareNamespace('soap':'http://schemas.xmlsoap.org/soap/envelope/')
def element=rootNode.'soap:Body'.'soap:Fault'.'faultstring'
if(element != ''){
rootNode.'soap:Body'.'soap:Fault'.replaceNode { }
rootNode.'soap:Body'.appendNode {
faultstring(element.text())
}
responseBodyTextFromTargetAPI = XmlUtil.serialize(rootNode)
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<faultstring>
javax.xml.ws.WebServiceException: com.exception.BaseUserException: Some Error.
</faultstring>
</soap:Body>
</soap:Envelope>
Bu sayfa yararlı mıydı?