shwetank
shwetank

Reputation: 115

Posting XML with Groovy HttpBuilder

i am trying to post some xml data using Groovy's HttpBuilder. POST XML data with Groovy HTTPBuilder answers the question on how to generate attributes (as id below)

<person id="1"></person>

but does not suggest how to specify value for this node. i have tried with constructs such as

apicall{
  user "userName"
  person(name:"name") "personName"
}

which generates an XML

<apicall>
  <user>userName</user>
  <person name='name'></person>
</apicall>

but the personName is missing! please suggest what am i missing here.

Upvotes: 0

Views: 537

Answers (1)

Will
Will

Reputation: 2978

See: http://www.javaworld.com/community/node/3017. They use

body: {
  widget(id:'129033'){
    type("TFR")
  }
}

which will be encoded to

<widget id='129033'>
  <type>TFR</type>
</widget>

Upvotes: 0

Related Questions