Forum Discussion

Liberty_Informa's avatar
Liberty_Informa
Regular Contributor
13 years ago

Request in Form and XML tab gets disturbed

Hi

This is bit of tricky for you to solve however taking chance if there is any existing solution.

We use couple of property expansions to build our requests at runtime. However when we switch to Form tab and return to XML tab, soapUI, thinking mandatory elements missing in the request, re-generates them. This requires duplicate elements to be removed manually.

As a work-around we have configured default request editor as Source in the Preferences. However enforcing it at each developer's machine is very difficult. The chances are that wrong xml requests get checked in our source control.

Answer from you is much appreciated.

Thanks.
  • Hi,

    hmm.. maybe enabling the "Remove Empty Content" for the request automatically removes the xml inserted by the Form editor!? If not, could you post an example of the XML that is inserted?

    thanks!

    /Ole
    SmartBear Software
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Hi

    This did not work.

    Had it worked, this is not feasible option for us to carry out this manual exercise in thousands of test requests and difficult to enforce it for each new request.

    The tags which are automatically generated after switching between form and code tabs are few mandatory elements from out request header part. We use request header using property expansion like below and these mandatory elements are covered into it.

    ${#Project#requestHeader}
  • Hi,

    ok - how about adding an outgoing RequestFilter.onRequest handler that removes the inserted content (if it is there..)? This would automatically be applied to all outgoing requests..

    Does that make sense?

    regards,

    /Ole
    SmartBear Software
  • Liberty_Informa's avatar
    Liberty_Informa
    Regular Contributor
    Not expert in this area but following code is not working. Can you send us corrected one? Wanted to strip off empty tags

    if( request == null )
    return

    // get request content
    def content = context.httpRequest.requestContent

    // empty content
    content = content.replaceAll( "<VersionInformation><Major/><Minor/></VersionInformation><ExecutionContext/>", "" )

    // write it back
    context.httpRequest.requestContent = content
  • Hi,

    I think it should just be

    context.requestContent

    instead of

    context.httpRequest.requestContent

    (in both usages)

    Does that help?

    regards,

    /Ole
    SmartBear Software