Forum Discussion

henrika's avatar
14 years ago

Modifying a SOAP request

Hi all,

I know this has been covered in other places, but I just can't seem to get it working.

I've got a test that is data driven using a spreadsheet. The service is for sending emails, the emails can have attachments added in the form of document ids.

This is what I'm currently doing (I'll be changing this so it uses values from the datasource):


// getting the request out of the test step
def request = context.expand('${Send#Request}')
def root = new XmlParser().parseText(request)

// set up some namespaces
....

// navigate to the appropriate place in the document and add the node
root[soap.Body][com.Send][com.req][0].appendNode('au1:Attachments').appendNode('au1:MessageAttachment').appendNode('au1:DocumentId','6691788')


Now I'm not quite sure what to do after that. I checked the resultant xml this way:


def writer = new StringWriter()
new XmlNodePrinter(new PrintWriter(writer)).print(root)
def result = writer.toString()


And it all looks ok, how do I put this back into the request for the test?
No RepliesBe the first to reply