Forum Discussion

KyleChen's avatar
KyleChen
New Contributor
8 years ago

Cannot get self-write lib in SoapUI open source version

I faced

 

"groovy.lang.MissingPropertyException: No such property: JsonUtils for class"

 

when using JsonUtils in SoapUI open source version. I can use the same step/code in ReadyAPI. 

  • nmrao's avatar
    nmrao
    Champion Level 3

    KyleChen,

     

    First of all thank you for mentioning the class JsonUtil, never happened to see that.

     

    It appears the class is available in Open Source Edition 5.1.2 onwards.

     

     

    Here is the little script created using JsonUtil class and got the output successfully.

     

    import com.eviware.soapui.support.JsonUtil
    def json = """{
       "parent":{
           "child":"oldValue"
        }
    }"""
    
    log.info JsonUtil.isValidJson(json)

     

     

     

     

    • KyleChen's avatar
      KyleChen
      New Contributor

      Hi nmrao

       

      my code is as below

       

      import com.eviware.soapui.support.JsonUtil //I add your suggestions

      def response = context.expand( '$My API response' )
      def jsonObj = JsonUtils.getJsonObj(response)

       

      and still shows the error 

      My version is (on Mac OS)

      SoapUI 5.3.0
      Copyright (C) 2004-2017 smartbear.com
      http://www.soapui.org | http://www.smartbear.com
      Build Date: 20161130-0556

       

      Thanks!

      • nmrao's avatar
        nmrao
        Champion Level 3

        1. Your second statement is invalid, it seems.
        2. There is no such class JsonUtils. It is JsonUtil. However, there is no "getJsonObj" method as well in JsonUtil.

        Please have a look at the javadoc:
        https://www.soapui.org/apidocs/index.html

  • nmrao's avatar
    nmrao
    Champion Level 3
    Ok.

    May be you can try to open SOAPUI_HOME/bin/soapui-xxx.jar file and see if that class is present.

    Also, it would be good if you can say your use case.
  • nmrao's avatar
    nmrao
    Champion Level 3

    KyleChen,

    Would you mind providing the script you were trying to use for review along with full stacktrace?

     

    What version are you using, by the way?