I have a function

  def result =
    asLongAs("${BUSY}", "BUSY") {
        .body(StringBody(new Maker().makeResult))

I Want to keep doing this function until the response xml return a status and not BUSY =>


But in this scenario I ask for a condition before the session contains the busy Attribute.

How can solve this?

I’m not sure I’m entirely following your question (admittedly, I’m not too familiar with the asLongAs DSL method either). So here’s what I assume you want to do:
While the response’s status is “busy”, continually execute the request.

Now, the first problem I noticed is that you’re saving the text “BUSY” in your session attribute "${BUSY}", when the docs say the session function must return a boolean (for some reason can’t copy+paste into the message, so look up docs yourself).

The resolution may be a simple transformation when saving “${BUSY}”:

.check(xpath("//status/text()") //this returns string “BUSY” I’m assuming
.transform((busyText: String) => busyText == “BUSY”).saveAs(“BUSY”))

Of course I have no idea what the response looks like when not busy, but this assumes status is not “BUSY” when not busy.

As for the session variable not yet being defined…

def result =
exec(session => { session.set(“BUSY”, true) }