Forum Discussion
rajeshbachani
15 years agoOccasional Contributor
Hello Unhandled!
Thanks for your reply.
I am sorry for not being very clear in the first post. But I will try to clarify the question here..
So, we have an XML element which contains child elements. Say it is of the form: <device><id1>1</id1><id2>1</id2><id3>1</id3></device>
And this is received as part of a SOAP Response A.
We want to create a SOAP Request B, in which this XML element <device> needs to be directly used with the child nodes.
Now two things can be done:
1. A property transfer directly from Response A to Request B. This works fine.
2. Saving the <device> into a Project property and retrieving that to fill up the <device> in Request B. This does not work. What is the problem in this? The problem is that when the transfer is done - the <device> element is filled with the value of the Project property - but also prepended with <CDATA> tags. Making the entire Request B to fail since it's not a valid tag.
We want to use the 2nd solution - as it makes it more flexible to reuse the property value holding <device/> at any later time, and from any test suite within the project.
On what I said regarding that we are using groovy scripts currently. Yes we are using that - but to do a property transfer for an atomic element in XML (one which does not have any children nodes). In such cases, when we save the value of the atomic element as a property on project level, and try to feed this into a request, it happens fine - without any CDATA. But the downside of this is that if the XML is huge, we will have to transfer all the values one by one, and also have one project-level property for each XML element. This is a lot of work. So, the goal is to be able to transfer the entire <device/> element into project-level property and be able to reuse it anywhere and anytime.
Do you understand the question and the problem now? I sure realize that I have much more information now, but I have been playing with these things since a week now - on and off - but still this CDATA thing is really restricting our ability to reuse values at the project level.
I will appreciate if you come back with some suggestions.
Thanks,
Raj.
Thanks for your reply.
I am sorry for not being very clear in the first post. But I will try to clarify the question here..
So, we have an XML element which contains child elements. Say it is of the form: <device><id1>1</id1><id2>1</id2><id3>1</id3></device>
And this is received as part of a SOAP Response A.
We want to create a SOAP Request B, in which this XML element <device> needs to be directly used with the child nodes.
Now two things can be done:
1. A property transfer directly from Response A to Request B. This works fine.
2. Saving the <device> into a Project property and retrieving that to fill up the <device> in Request B. This does not work. What is the problem in this? The problem is that when the transfer is done - the <device> element is filled with the value of the Project property - but also prepended with <CDATA> tags. Making the entire Request B to fail since it's not a valid tag.
We want to use the 2nd solution - as it makes it more flexible to reuse the property value holding <device/> at any later time, and from any test suite within the project.
On what I said regarding that we are using groovy scripts currently. Yes we are using that - but to do a property transfer for an atomic element in XML (one which does not have any children nodes). In such cases, when we save the value of the atomic element as a property on project level, and try to feed this into a request, it happens fine - without any CDATA. But the downside of this is that if the XML is huge, we will have to transfer all the values one by one, and also have one project-level property for each XML element. This is a lot of work. So, the goal is to be able to transfer the entire <device/> element into project-level property and be able to reuse it anywhere and anytime.
Do you understand the question and the problem now? I sure realize that I have much more information now, but I have been playing with these things since a week now - on and off - but still this CDATA thing is really restricting our ability to reuse values at the project level.
I will appreciate if you come back with some suggestions.
Thanks,
Raj.