Contributions
- 1.2KViews0likes0Comments
soap mock war not accessible
Has created mock Services for both rest and soap services Had deployed them in Tomcat server and verified the end point Soap services are accessible but Rest services are not accessible in the same server . Rest mock service Name: REST MockService End point for Soap services : http://10.103.2.89:8080/soapfile/ when I use below for rest http://10.103.2.89:8080/restfile/ its not working tried below too http://10.103.2.89:8080/restfile/REST MockService but the space in between REST and MockService is being converted into %201.3KViews0likes4Commentsdeploy as war error
Tried to deploy as war Created rest and soap war files and placed under webapps folder of tomcat server and started it , the desired structure came off but when trying to check the soap response from web ui getting error Request fired from Chrome: http://10.103.2.89:8080/soap/ HTTP Status 500 - com/eviware/soapui/mockaswar/MockAsWarServlet : Unsupported major.minor version 51.0 (unable to load class com.eviware.soapui.mockaswar.MockAsWarServlet) type Exception report message com/eviware/soapui/mockaswar/MockAsWarServlet : Unsupported major.minor version 51.0 (unable to load class com.eviware.soapui.mockaswar.MockAsWarServlet) description The server encountered an internal error that prevented it from fulfilling this request. exception java.lang.UnsupportedClassVersionError: com/eviware/soapui/mockaswar/MockAsWarServlet : Unsupported major.minor version 51.0 (unable to load class com.eviware.soapui.mockaswar.MockAsWarServlet) org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:3129) org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:1341) org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1827) org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1701) org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:436) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1078) org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625) org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:318) java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146) java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) java.lang.Thread.run(Thread.java:701)Solved2.6KViews0likes1CommentRe: replace response with parameter from request
Hirupert_anderson I have tried below code def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def holder = groovyUtils.getXmlHolder(mockRequest.requestContent) def soNumber = holder.getNodeValue("//UPRN") def file = new File (groovyUtils.projectPath+"/mockResponses/${soNumber}.xml") log.info soNumber def fileToLoad = 'default' if (file.exists()) { fileToLoad = soNumber context.content = groovy.xml.XmlUtil.serialize(new XmlParser().parse(groovyUtils.projectPath+"/mockResponses/${fileToLoad}.xml")) } else{ requestContext["uprn"]=soNumber return "default" } I have added another response to mock service named default as shown in figure and had hit the request and below is the response I got where in the UPRN was not populating at all Response :6.4KViews0likes0CommentsRe: replace response with parameter from request
Hirupert_anderson nmrao I am posting my script I am having problem with the else part where I want Rupert above solution to be inserted and the new xml to be served back def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) def holder = groovyUtils.getXmlHolder(mockRequest.requestContent) def soNumber = holder.getNodeValue("//UPRN") def customerId = mockRequest.requestHeaders['UPRND'][0] def file = new File (groovyUtils.projectPath+"/mockResponses/${soNumber}.xml") log.info soNumber def fileToLoad = 'SoapFault' if (file.exists()) { fileToLoad = soNumber context.content = groovy.xml.XmlUtil.serialize(new XmlParser().parse(groovyUtils.projectPath+"/mockResponses/${fileToLoad}.xml")) } else{ def tempContent = groovy.xml.XmlUtil.serialize(new XmlParser().parse(groovyUtils.projectPath+"/MOCK/default.xml")) /**replacing the place holders in the response **/ tempContent = tempContent.replace("\$uprnumber",customerId) //finall setting the response content context.content = tempContent }6.5KViews0likes0Commentsreplace response with parameter from request
Hi All, In the below case i need a script for both rest and soap services SOAP services 1.Request consists of a value UPRN which is the key driver 2.I have external file where my UPRN file specific responses are placed , if specific file is found response should be specific to file --- I have implemented this already 3.if in the folder of responses the UPRN file is not found then I have a default xml where in , the UPRN field of the default xml should be changed to the one supplied in my request and I should get an amended response back with the UPRN field only changed to the value that came from request , rest all content be same as its from default file . Is this possible ?? attaching request and response I would need thsi for both soap and rest services , in rest I have a parameter which needs to be replaced Adding files for my Rest request and response too and also the code I implemented till now . I would need code to be modifiedsuch that in case if post file doesn't exist the post code in the response should be changed to the post code from request and the response to be served back , only the post code to be changed rest all to be retained as is def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context) String URL = mockRequest.getRequest().getQueryString() log.info "QueryString: " + URL def postcode = URL.substring(URL.lastIndexOf("postcode")+9, URL.lastIndexOf("postcode")+15); log.info "Postcode: " + postcode /*def soNumber = holder.getNodeValue("//*:BillingOrderLoadRequest/*:salesOrderNumber")*/ def responseFileContent = new StringBuilder() File testDataFile = new File(groovyUtils.projectPath+"/mockResponsesjson/${postcode}.json") //Load file containing test data response if (testDataFile.exists()){ testDataFile.eachLine {content, lineNumber -> responseFileContent.append(content) //Add each line of test data file to a String } }else{ responseFileContent="File not found!" //Or perhaps return a SOAP fault? } mockResponse.responseContent=responseFileContent //Populate response body mockResponse.responseHttpStatus=200 //set status code (can also be done in UI) def headers = mockResponse.responseHeaders headers["Content-Type"]=["application/json"] mockResponse.responseHeaders=headers //Headers can also be set in the UISolved6.5KViews0likes6Comments