Created
October 21, 2022 07:28
-
-
Save magohl/95723d6842c7b35847eca4ae16150955 to your computer and use it in GitHub Desktop.
SoapUI - Mock response script Random content
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
script: | |
def holder = new com.eviware.soapui.support.XmlHolder( mockRequest.requestContent ) | |
def someInput = holder["//*[local-name()='SomeInput']"] | |
def random = Math.random() | |
requestContext.someInput = someInput | |
requestContext.randomText = random.toString() | |
response: | |
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://kramerica-industries.lan/webservices/dummyservice/1.0" xmlns:res="http://oresundsbron.com/types/result"> | |
<soapenv:Header/> | |
<soapenv:Body> | |
<ns:DoStuffResponse> | |
<ns:SomeResult> | |
<!--Mocked from SoapUI--> | |
<res:ID>${someInput}</res:ID> | |
<res:Description>Here is a random number ${randomText}. Now was it cached or not?</res:Description> | |
</ns:SomeResult> | |
</ns:DoStuffResponse> | |
</soapenv:Body> | |
</soapenv:Envelope> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment