JHoreczky
13 years agoContributor
Modyifing REST request msg AFTER submit
Hi,
In a REST type request, sent through HTTP POST to a servlet, an example of a concrete request looks like this (cut and paste from the soapUI log):
Wed Jul 11 23:57:45 MDT 2012:DEBUG:Sending request: POST /myServlet?Province=XY&Address=123&Street=JOHNSON HTTP/1.1
What I wish to do, after when the request was sent, I wish to reformat the request into an XML document and write it back, so that it appears in Message Viewer / Request Message window as an XML document. Currently in Message Viewer / Reques Message there is content under the Raw tab only, as under the XML tab the display says: "<not-xml/>
I am trying to use a groovy script triggered by the RequestFilter.filterRequest event for the above.
I know what I am trying to do is feasible for the response. For example this works for RequestFilter.afterRequest:
context.httpResponse.responseContent = "<myresponse>blah</myresponse>"
- which will then be displayed under Message Viewer / Response Message
Is there a similar way for modifying the request (basically reformatting it for display purposes only) ?
Thanks,
Joseph H.
In a REST type request, sent through HTTP POST to a servlet, an example of a concrete request looks like this (cut and paste from the soapUI log):
Wed Jul 11 23:57:45 MDT 2012:DEBUG:Sending request: POST /myServlet?Province=XY&Address=123&Street=JOHNSON HTTP/1.1
What I wish to do, after when the request was sent, I wish to reformat the request into an XML document and write it back, so that it appears in Message Viewer / Request Message window as an XML document. Currently in Message Viewer / Reques Message there is content under the Raw tab only, as under the XML tab the display says: "<not-xml/>
I am trying to use a groovy script triggered by the RequestFilter.filterRequest event for the above.
I know what I am trying to do is feasible for the response. For example this works for RequestFilter.afterRequest:
context.httpResponse.responseContent = "<myresponse>blah</myresponse>"
- which will then be displayed under Message Viewer / Response Message
Is there a similar way for modifying the request (basically reformatting it for display purposes only) ?
Thanks,
Joseph H.