13 years ago
changing soap request xml tag
Hey there,
last week I ran into a problem and am still unable to solve it. I searched with google for quite some time but did not find anything helpful despite the problem itself appearing to be rather simple.
All I want to do is: Run a soap request and afterwards change a name-tag in it using groovy.
The problem: I've got a request and a response wich will be compared by a groovy script. Unfortunately there are 3 xml tags (names) which have to be altered in the request / response as they dont match.
As I'm using a XmlSlurper to process both I tried to replace the nodes
but I cant seem to get the request to update after doing this as a search for the going-to-be tag name returns a false.
Is there something crucial I am missing? Any advice is appreciated.
last week I ran into a problem and am still unable to solve it. I searched with google for quite some time but did not find anything helpful despite the problem itself appearing to be rather simple.
All I want to do is: Run a soap request and afterwards change a name-tag in it using groovy.
The problem: I've got a request and a response wich will be compared by a groovy script. Unfortunately there are 3 xml tags (names) which have to be altered in the request / response as they dont match.
As I'm using a XmlSlurper to process both I tried to replace the nodes
def holder = new XmlSlurper().parseText(createRequestHolder.getXml())
def node1 = holder.depthFirst().find{it.name().equals('Envelope')} //just an example
def xmlOut = new StreamingMarkupBuilder()
node1.replaceNode{ node ->
t(){delegate.mkp.yield node.getBody()}
}
xmlOut.bind{ mkp.yield holder}
but I cant seem to get the request to update after doing this as a search for the going-to-be tag name returns a false.
Is there something crucial I am missing? Any advice is appreciated.