Forum Discussion
3 Replies
Sort By
- SmartBear_SuppoSmartBear Alumni (Retired)Hello,
You are creating test steps with associated operations. When test step is run associated operation, or to be more precise request(s) in that operation is called. So, basically you could iterate trough all requests in operation, get their headers and modify them.
Use WsdlOperation.getRequestAt() or WsdlOperation.getRequestByName() to get request and than WsdlRequest.getRequestHeaders() and to set them WsdlRequest.setRequestHeaders().
Hope this helps, let me know.
robert - enlivenContributorSorry, I should have been more explicit. I am trying to perform the SoapRequest Header change during creation of new TestRequests from New or Existing project requests. When I access the wsdlTestCase.addTestStep(testStepConfig).wsdlTestRequestStep.getTestRequest().getReqeustHeaders() they are empty, but the generated TestStepRequests have full soapEnv with Default or Existing custom header intact (which is what I need to replace).
suggestions? - enlivenContributorI 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
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>
Related Content
- 2 years agoKimdongart1
- 6 years ago678