ContributionsMost RecentMost LikesSolutionsRe: How 'find' command to be used to fetch results from mongoDB using groovy in soap ui Any help would be great regarding the above problem. Thanks Deepali Re: How 'find' command to be used to fetch results from mongoDB using groovy in soap ui import com.mongodb.* import com.mongodb.MongoCredential as MC import com.mongodb.ServerAddress def credential = MC.createMongoCRCredential( "<username>", "<DBname>", "<pwd>".toCharArray() ) def mongoClient = new MongoClient( new ServerAddress("<server sddress>"), [ credential ] ) log.info "Connect to database successfully" DB db = mongoClient.getDB( "qahmedb" ); DBCollection coll = db.getCollection("Hotel"); log.info "Collection Hotel selected successfully" DBCursor cursor = coll.find({City_en : 'Orlando' }); List list1 = new ArrayList(); while( cursor.hasNext() ) { def hotel = cursor.next() log.info "Found Hotels with ID $hotel._id and name $hotel.Title_en" } Stack trace: 2016-01-25 15:56:32,000 ERROR [errorlog] org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'DBCollection{database=DB{name='qahmedb'}, name='Hotel'}' with class 'com.mongodb.DBCollection' to class 'com.mongodb.DBCursor' org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'DBCollection{database=DB{name='qahmedb'}, name='Hotel'}' with class 'com.mongodb.DBCollection' to class 'com.mongodb.DBCursor' at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405) at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319) at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:232) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:603) at Script43.run(Script43.groovy:15) at com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:92) at com.eviware.soapui.support.scripting.groovy.SoapUIProGroovyScriptEngineFactory$SoapUIProGroovyScriptEngine.run(SoapUIProGroovyScriptEngineFactory.java:76) at com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:155) at com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel$RunAction$1.run(GroovyScriptStepDesktopPanel.java:263) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) With condition City_en : 'Orlando', it has 3 records, while in total it has 500+ records. It gives successful result when done without any condition in find query. Re: How 'find' command to be used to fetch results from mongoDB using groovy in soap ui Thanks Rao for your help...but I have already tried this...but no luck. How 'find' command to be used to fetch results from mongoDB using groovy in soap ui Below is the groovy code snippet I have written. DB db = mongoClient.getDB( "qahmedb" ); DBCollection coll = db.getCollection("Hotel"); log.info "Collection Hotel selected successfully" DBCursor cursor = coll.find({City_en : 'Orlando' }); List list1 = new ArrayList(); while( cursor.hasNext() ) { def hotel = cursor.next() log.info "Found Hotels with ID $hotel._id and name $hotel.Title_en" } It is leading to error message as "ERROR:An error occurred [Cannot cast object 'DBCollection{database=DB{name='qahmedb'}, name='Hotel'}' with class 'com.mongodb.DBCollection' to class 'com.mongodb.DBCursor'], see error log for details" While if I am using direct find query without any condition like DBCursor cursor = coll.find(); It gave results successfully without any error. Kindly help with the possible solutions. Thanks Deepali Re: SocketTimeoutException in SOAP UI Change test case settings from settings viewer of test case. Please find screenshot as attached. Hope this is what you are looking for. Regards Deepali Re: "Unexpected end of file after null" error while execution REST test case with assertions. Thanks Rao, But my content type was already application/json. I got the solution for this issue. There is a setting in Test case options with check box as "Diaply OK Result". If I unchecked it, I am able to see request and response. "Unexpected end of file after null" error while execution REST test case with assertions. I am getting error as "Unexpected end of file after null" while execution REST test case with assertions. Steps: 1. create REST request in JSOn format. 2. Add assertions 3. Add request to tes case 4. Run test case 5. Click on test step to check request -response. Expected Result: Resuest-Response should be displayed correctly. Actual result: Getting error as "org.apache.xmlbeans.xmlexception:error:Unexpected end of file after null" in outline view. and <<Not JSON content> in JSON tab. Observation: If I remove assertion, Request-Response are getting generated successfully. Solved