Contributions
Re: How to log requests in a mock service
Thanks to JHunt for that. This is such weird syntax.It gets me a bit closer to seeing the request, although it's the query string that I was hoping to expose. I see that two slightly different function calls have been suggested for the same thing (by different posters), namely:- log.info(mockRequest.getRequestContent()) and log.info mockRequest.requestContent Why the different syntax? Is one of them wrong or are they equivalent? Thanks.36KViews0likes0CommentsRe: How to log requests in a mock service
This is exactly the problem I have and the same version of SoapUI that I am running (5.2.1). I was overjoyed to find this post, but I cannot get the solution to work for me. WhenI slavishly added the line log.info(mockRequest.getRequestContent()) to the"OnRequest Script" box in my REST MockService editor, first of all it seemed to object to the syntax by highlighting one of the brackets. So I added a semi-colon at the end to make it read as follows:- log.info(mockRequest.getRequestContent()); The highlighting disappeared, so I figured that was a good move. When I ran my mock service and threw a request at it, still I was unable to inspect the request contents wit the double-click on the entry in the Message Log. Am I being daft here? Is the word "mockRequest" a key word or do I have to replace it with the specific name of my request (in which case which name would that be)? Also, I have a "Message Log" exposed in my running mock service; where is the "Script Log" which you mention? If you mean the "script log" button at the foot of the SoapUI IDE, this just shows entries which look like this:- Fri Feb 16 17:39:28 GMT 2018:INFO:null The "http log" appears to record, in a very raw form, the incoming request; but it does this whether or not I include this recommended line of script code above. So I am still baffled.37KViews0likes0CommentsRe: Please gives us back decent borders
I appreciate that the developers get their salary from the sales of the paid-for product, but given that new releases of the free edition do come out every so often, there must be some development stream going into it. And for the free edition to be a representative product to encourage users to buy the real thing, it has toresemble it reasonably well, doesn't it? The One-Pixel Grab is not a dance I enjoy. It's an aspect of the product that causes me anxiety every time I use the product.3.3KViews0likes0CommentsUsing scripting to choose a response based on the request
I have a mock service (SOAP XML) with a number of canned responses defined. The request that comes in includes an ID field. I should like to choose which response to send back to my client based on the value of the ID. Iappreciate that I need to choose "Dispatch: SCRIPT" in the Operation dialog panel but I am stumped after that. I have in the past successfully defined a sequence for sending the responses which was different from the default order in which they are listed, although that was a long time ago and that was as sophisticated as it got. Can someone please help? -- SoapUI (free edition) 5.2.11.3KViews0likes2CommentsRe: Export full WSDL ( including imported schema )
Did anything further happen with this in the ten years that has elapsed? It seems to me entirely sensible for the tool to save, within the project, a copy of the original WSDL file, which it could eport on request. For example, if you have two SoapUI projects and you want to check if they have used the same WSDL, such a feature would enable this. I have just this situation. I have justused the Export Definition function and the output looks quite different fromthe original WSDL file. If theoutput from the Export Definition function is different, what earthly use is it? Or have I missed something?22KViews0likes0CommentsRe: Mock REST Services to return JSON response
>on bottom of response editor expand the headers tab and enter: I have a similar error and I cannot locate this feature to expand the headers tab. This mocking feature works simply for my project using old-fashioned SOAP XML web services, but this REST stuff seems more complicated. == SoapUI-5.2.1 Community/free edition14KViews0likes2CommentsRe: simple scripting in a Mock Service - no longer works
I have found a solution. I have moved on to a new SoapUI project (a SOAP project, this time, not REST) and just for the sake of punishing myself I tried again to construct a custom sequence. I have taken bits of a coupe of the kind responses and amended them based on my observations and have come up with the following. I realised that the script log was showing the values ofmy list items with the square brackets around them. It occurred to me that astatement likethis:- myRespList = ["Response_2","Response_1"] - must do a bit more than just insertthe two strings"Response_2" and "Response_1" to a list; it must be adding the square brackets around the words first. No idea why. I re-named my methods to include the square brackets and suddenly the thing is working. Here are the details:- My Responses in the method are as follows:- [Response_Template] [Response_1] [Response_2] My code (heaviliy influenced by previous contributors) is as follows. // get the list from the context def myRespList = context.myRespList // if list is null or empty reinitalize it if (!myRespList || !myRespList?.size) { log.info "--> Refreshing the list" // list in the desired output order myRespList = ["Response_2","Response_1"] } // take the first element from the list def myResp = myRespList.take(1) // update the context with the list without this element context.myRespList = myRespList.drop(1) // return the response log.info "--> Response is: " + myResp return myResp; The output in the script is like this:- Fri Oct 09 18:34:47 BST 2015:INFO:--> Refreshing the list Fri Oct 09 18:34:47 BST 2015:INFO:--> Response is: [Response_2] Fri Oct 09 18:34:50 BST 2015:INFO:--> Response is: [Response_1] Fri Oct 09 18:34:51 BST 2015:INFO:--> Refreshing the list Fri Oct 09 18:34:51 BST 2015:INFO:--> Response is: [Response_2] Fri Oct 09 18:34:51 BST 2015:INFO:--> Response is: [Response_1] Fri Oct 09 18:34:52 BST 2015:INFO:--> Refreshing the list Fri Oct 09 18:34:52 BST 2015:INFO:--> Response is: [Response_2] The SOAP XML Responses from the mock service are swicthing betwen Response_2 andResponse_1 as desired.3.8KViews2likes2Comments