msche72
14 years agoNew Contributor
Nullpointer exception when invoking rest call on mocked serv
Dear all,
When I try to invoke a call on the mocked rest service i get the following exception:
I started the Mocked service via maven, the plugin is configured as follows:
The plugin version I'm using is 4.5.0-SNAPSHOT.
The onRequest script is as follows:
What am I doing wrong?
Thanks,
Mark
When I try to invoke a call on the mocked rest service i get the following exception:
11:15:17,867 INFO [log] Retrieved request/csdb-mock/hu/testother/startwith content null
11:15:17,867 INFO [log] Grabbed muid testother of request
11:15:17,883 INFO [log] DONE
11:15:17,899 INFO [log] Retrieved response2012-04-26 11:15:17.852: [dispatch error; missing response]
11:15:17,899 ERROR [SoapUI] An error occured [java.lang.NullPointerException], see error log for details
java.lang.NullPointerException
at com.eviware.soapui.tools.SoapUIMockServiceRunner$LogListener.onMockResult(SoapUIMockServiceRunner.java:230)
at com.eviware.soapui.impl.wsdl.mock.WsdlMockRunner.dispatchRequest(WsdlMockRunner.java:396)
at com.eviware.soapui.monitor.JettyMockEngine$ServerHandler.handle(JettyMockEngine.java:714)
at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:945)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
I started the Mocked service via maven, the plugin is configured as follows:
<plugin>
<groupId>eviware</groupId>
<artifactId>maven-soapui-plugin</artifactId>
<configuration>
<projectFile>
${basedir}/src/SoapUI/CSDB-Mock-soapui-project.xml
</projectFile>
<host>http://127.0.0.1</host>
<port>8080</port>
</configuration>
</plugin>
The plugin version I'm using is 4.5.0-SNAPSHOT.
The onRequest script is as follows:
import com.eviware.soapui.impl.wsdl.mock.WsdlMockResult
WsdlMockResult mockResult = new WsdlMockResult( mockRequest );
if(mockRequest.method == "PUT") {
// Retrieve MUID of request
String muid = mockRequest.getPath().tokenize('/')[2]
log.info "Retrieved request" + mockRequest.path + "with content "+ mockRequest.requestContent ;
log.info "Grabbed muid " + muid + " of request"
switch (muid) {
case "test":
mockRequest.httpResponse.status = 500
;
break
default:
mockRequest.httpResponse.status = 204;
}
} else {
//log.warn "Received invalid request for CSDB notification"
log.info "Retrieved request" + mockRequest.path;
mockRequest.httpResponse.status = 405;
}
log.info "DONE"
return mockResult;
What am I doing wrong?
Thanks,
Mark