I have to make a SOAP request and its format is like this:
<parentname>test</parentname>
<address>16, texas</address>
<childrennames>
<child>c1</child>
<child>c2</child>
<child>c3</child>
</childrennames>
<email>parent@gmail.com</email>
How to send request for childrennames tag?
One of the easiest approach, would be to have your entire SOAP request in a
StringBuilderwith some unique keys in place of actual values. Replace your keys by actual values at Runtime usingStringBuilder#replaceAll(..)and then post this String to the server asStringEntityby setting the content-type for the entity as XML.For e.g: You can create a template as:
and then replace
@parentName@by the actual value at runtime.You can use tools such as SOAPUI to generate the entire SOAP request XML.
Hope you get a picture.
[EDIT : adding example for illustration]
Supposing you have to create this SOAP request:
What I suggested was creating a
Stringtemplate and then replacing values in the template at run time:I hope that makes sense.