Forum Discussion

momer's avatar
momer
New Contributor
12 years ago

FIX in SOAP UI

Hi,
I have been working with SoapUI 4.6 for a while now. I have created a mock service for a REST service using the procedures stated in the documentation. I tried to run the mock service from the GUI and it worked quite fine. I then used the CLI mockservicerunner to run the same service and it also worked great. But then I tried to deploy the project as a war file and then came across a problem. The service was started but it was not really being run when a request arrives. So I decided to download the whole source code and see where the problem is. I found it out and fixed it then built it and it is now working. Now my problem is, how could I share this fix with you guys. I read on the site that I have to fill out the contribution form and send it via fax. But is it really that important for such a small fix. I mean, I only changed like two or three lines of code. What do you guys think?

Mo,

6 Replies

  • SiKing's avatar
    SiKing
    Community Expert
    Consider this: If you were running a company and decided to allow the community to contribute to your application, how many different ways / formats would you want to support for accepting patches? Where would you draw the line in legally protecting your company and cutting corners?

    I created my first small fix the other day, the entire setup from zero (I did not even have a GitHub account) to submission took me 1 hour. Second time around I could probably do the same thing in 10 minutes.
  • Hi!

    Awesome to hear that you want to contribute to the project!

    The reason that we have to ask you to fill in that contributor form is because, while we love patches from the community, we can't risk anything legally (at least so says our lawyer).

    Best Regards

    Henrik
    LoadUI developer
  • momer's avatar
    momer
    New Contributor
    Hi guys,

    Thanks for the replies everyone. I will fill the contributor form and send it soon. I am with the opinion that SoapUI is one of the coolest open source projects that has a big community so it is worth it.

    best regards
  • momer's avatar
    momer
    New Contributor
    Hi guys,

    I tried to send email but apparently the email address doesn't work. I receive a mail delivery failure. Anyway, I can explain the issue here. I created a MockService in soapUi which shall accept request and return responses. I had a groovy script to handle this. It worked as expected when started from soapUi. But then when I built the war file and deployed it in a servlet container like Tomcat, the MockService was read during initialization but was not added to the list of mock runners to be started. So when a request is sent, a "log is disabled" response is received. This same request works well inside soapUi. So I cloned the soapUi repo and modified the file MockAsWarServlet.init() method. There is a loop at the bottom which goes over all mockServices and calls start. The start method creates a mockRunner object but the return type was ignored. So I stored the mockRunner in a variable and then added it to the list if not null.

    for( MockService mockService : project.getMockServiceList() )
    {
    logger.info( "Starting mockService [" + mockService.getName() + "]" );
    if( StringUtils.hasContent( mockServiceEndpoint ) )
    {
    ( ( WsdlMockService )mockService ).setMockServiceEndpoint( mockServiceEndpoint );
    }

    MockRunner mockRunner = mockService.start();
    if(mockRunner != null)
    {
    logger.info("Added a MockRunner");
    ((MockServletSoapUICore) getMockServletCore()).startMockService(mockRunner);
    }
    }



    The last part which checks if the mockRunner is not null and adds it to the MockServletCore is the part that I have added. After building soapUi with this fix and creating a war file from the same mockServlet, everything is working fine.