Forum Discussion
enliven
17 years agoContributor
I was able to resolve using the following to replace the current generated custom soap header with one populated by from DataGen. Im not able to generate test cases with much of the common testing stuff I need, now for the rest 
which will change:
to:

def holder = groovyUtils.getXmlHolder(currentRequest.getRequestContent())
def xmlUtils = new com.eviware.soapui.support.xml.XmlUtils();
def dNode = holder.getDomNode("//ns:RequestHeader")
holder.removeDomNodes(xmlUtils.createXPath(dNode))
holder["//soapenv:Header"] = RequestHeaderExpansion
wsdlTestRequestStep.getTestRequest().setRequestContent(holder.xml)
which will change:
<soapenv:Header>
<ns:RequestHeader>
<ns:CompanyCode>xxx</ns:CompanyCode>
<ns:UserName>xxx</ns:UserName>
<ns:Password>xxx</ns:Password>
<ns:DataStoreName>xxx</ns:DataStoreName>
<ns:RequestId>xxx</ns:RequestId>
</ns:RequestHeader>
</soapenv:Header>
to:
<soapenv:Header>
${=context.testCase.testSuite.project.testSuites["TestSuite-Project"].getTestCaseByName("ConnectionProperties").getTestStepByName("DataGen").getPropertyValue("RequestHeader")}
</soapenv:Header>