Forum Discussion

DW's avatar
DW
Occasional Contributor
10 years ago

Setting parameter in REST post xml mesage and checking result

Another noob question...   We have a REST xml service that uses Post. It only has one value in the request, lets call it CustomerReference and returns a few details, such as name and if they are ac...
  • rupert_anderson's avatar
    10 years ago

    Hi,

     

    Assuming you set your customerReference as a property somewhere convenient, propbably on the context variable e.g. context["customerReference"]="12345 (you could set this in a Groovy TestStep preceeding your request for example)

     

    Then its as easy as inserting a property expansion into the request body e.g.

     

    <GetCustRef ns: xxxx>

    <message header ns: xxxx>

    some stuff

    </message header>

    <request>

    ${customerReference}

    </request>

    </GetCustRef>

     

    In terms of checking the results do you need any help with Assertions e.g. content, XPath or Script Assertions are obvious candidates to check XML response values? Note - you could also use property expansions in the Assertions if you have values that you wish to check for that are in properties...

     

    Let me know if this fixes you up or you need any more help.

    Cheers,

    Rup