Forum Discussion
That just proves you should make sure you read everyones posts before responding to the last. I also suggested groovy using an event handler. Unfortunately i didnt notice everyone else suggested this too!
Cheers
Rich
Sorry richie
I saw the solution with a Groovy script and I tried it and it somehow did not work. If it helps i can provde the XML and the ExcelFile with the Data and the Script i found on the web. Maybe it is a simple mistake from my side. However, i am not very familiar with scripts and the groovy language (or any programming language). I also use SoapUI pro wîth ReadyAPI 3.3.1
This would be the XML Request:
<v1:Request>
<Document>
<v13:FamilyName>
<v13:PrimaryValue>${TestData_DataEntry#FamilyName}</v13:PrimaryValue>
</v13:FamilyName>
<v13:FirstName>
<v13:PrimaryValue>${TestData_DataEntry#FirstName}</v13:PrimaryValue>
</v13:FirstName>
<v13:DateOfBirth>${TestData_DataEntry#DateofBirth}</v13:DateOfBirth>
<v13:Nationality>
<v13:Code>${TestData_DataEntry#Nationality}</v13:Code>
</v13:Nationality>
<v13:Gender>
<v13:Code>${TestData_DataEntry#Gender}</v13:Code>
</v13:Gender>
<v13:DocumentNumber>${TestData_DataEntry#DocumentNumber}</v13:DocumentNumber>
<v13:DocumentType>
<v13:Code>${TestData_DataEntry#DocumentType}</v13:Code>
</v13:DocumentType>
<v13:ValidUntil>${TestData_DataEntry#ValidUntil}</v13:ValidUntil>
</Document>
</v1:Request>
------------------------------------
This would be the ExcelSheet where the Data is taken:
| FamilyName | FirstName | DateOfBirth | Gender | DocumentNumber | ValidUntil | DoumentType |
| PETER | 19760101 | 0109 | E15687 | 2023-05-12 | 6001 |
------------------------------------
This is the groovy Script i found:
def groovyUtils = new com.eviware.soapui.support.GroovyUtils( context )
def stepName = context.getCurrentStep().getLabel()
def holder = groovyUtils.getXmlHolder( stepName + "#Request")
// Find nodes that only consist of whitespaces.
for( item in holder.getDomNodes( "//*[normalize-space(.) = '' and count(*) = 0]" )){
item.parent().removeXobj()
}
// Update the request and write the updated request back to the test step.
holder.updateProperty()
context.requestContent = holder.xml
I have implemented it under "projects>events>"projectRunListener.beforeRun" and "RequestFilter.filterRequest.
Sorry again for my little knowledge..
Thank you guys