Forum Discussion

bflynnbyx's avatar
bflynnbyx
Occasional Visitor
4 years ago
Solved

Problem With parameterized paths

Hi, 

 

I have a simple REST API that exposes an operation to get an account as follows

 

GET /accounts/{account_id}

 

I have created a virtual API based on this API. While I can exercise actions with non-parameterized paths when I invoke the above action I receive a 500 response. 

 

Here is the request:

 

GET http://localhost:8088/accounts/1234 HTTP/1.1
Accept-Encoding: gzip,deflate
Authorization: *****
Content-Length: 0
Host: localhost:8088
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/15)

 

And response:

 

HTTP/1.1 500 Server Error
Date: Tue, 05 Jan 2021 12:16:33 GMT
Transfer-Encoding: chunked

 

I can see the following error in the error log:

 

  • Tue Jan 05 12:16:33 GMT 2021: ERROR: got an exception while dispatching - returning a default 500 response
  • Tue Jan 05 12:16:33 GMT 2021: ERROR: java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 10 (?.*\n*.*) ^
  • java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 10
  • (?.*\n*.*)
  • ^
  • at java.base/java.util.regex.Pattern.error(Pattern.java:2028)
  • at java.base/java.util.regex.Pattern.groupname(Pattern.java:2967)
  • at java.base/java.util.regex.Pattern.group0(Pattern.java:3013)
  • at java.base/java.util.regex.Pattern.sequence(Pattern.java:2124)
  • at java.base/java.util.regex.Pattern.expr(Pattern.java:2069)
  • at java.base/java.util.regex.Pattern.compile(Pattern.java:1783)
  • at java.base/java.util.regex.Pattern.(Pattern.java:1430)
  • at java.base/java.util.regex.Pattern.compile(Pattern.java:1095)
  • at com.eviware.soapui.impl.rest.mock.RestMockService.getTemplateValues(RestMockService.java:270)
  • at com.eviware.soapui.impl.rest.mock.RestMockService.findMatchedOperation(RestMockService.java:255)
  • at com.eviware.soapui.impl.rest.mock.RestMockService.findMatchingOperationWithExactPath(RestMockService.java:179)
  • at com.eviware.soapui.impl.rest.mock.RestMockDispatcher.getMockResult(RestMockDispatcher.java:102)
  • at com.eviware.soapui.impl.rest.mock.RestMockDispatcher.lambda$0(RestMockDispatcher.java:56)
  • at com.eviware.soapui.model.support.HasMockResultsMockDispatcher.doDispatch(HasMockResultsMockDispatcher.java:90)
  • at com.eviware.soapui.impl.rest.mock.RestMockDispatcher.dispatchRequest(RestMockDispatcher.java:56)
  • at com.smartbear.servicev.core.engine.impl.soapui.SoapUIHttpVirt.getHttpVirtResponse(SoapUIHttpVirt.java:296)
  • at com.smartbear.servicev.core.engine.impl.soapui.SoapUIHttpVirt.regularDispatch(SoapUIHttpVirt.java:262)
  • at com.smartbear.servicev.core.engine.impl.soapui.SoapUIHttpVirt.regularDispatch(SoapUIHttpVirt.java:1)
  • at com.smartbear.servicev.core.engine.impl.AbstractVirt.dispatch(AbstractVirt.java:145)
  • at com.smartbear.servicev.core.model.http.impl.HttpVirtServerHandler.dispatch(HttpVirtServerHandler.java:151)
  • at com.smartbear.servicev.core.model.http.impl.HttpVirtServerHandler.handle(HttpVirtServerHandler.java:77)
  • at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
  • at org.eclipse.jetty.server.Server.handle(Server.java:516)
  • at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:388)
  • at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:633)
  • at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:380)
  • at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:273)
  • at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
  • at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:105)
  • at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
  • at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
  • at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
  • at java.base/java.lang.Thread.run(Thread.java:832)

Is this a known issue with REST APIS?

 

 

 

  • Hi,

    I'm assuming this is more of a mock API issue rather than a SoapUI issue.

    I'd look at the mock implementation that validates an id because of the thrown exception....

     

    • Tue Jan 05 12:16:33 GMT 2021: ERROR: java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 10 (?.*\n*.*) ^
    • java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 10
    • (?.*\n*.*)
    • ^

    I haven't used SoapUI/ReadyAPI mocking functionality, so I'm not best placed to comment.  Some code snippets/screenshots of the validation may help someone else help you.

     

    Good luck,

     

    Chris

3 Replies

  • ChrisAdams's avatar
    ChrisAdams
    Champion Level 2

    Hi,

    I'm assuming this is more of a mock API issue rather than a SoapUI issue.

    I'd look at the mock implementation that validates an id because of the thrown exception....

     

    • Tue Jan 05 12:16:33 GMT 2021: ERROR: java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 10 (?.*\n*.*) ^
    • java.util.regex.PatternSyntaxException: named capturing group is missing trailing '>' near index 10
    • (?.*\n*.*)
    • ^

    I haven't used SoapUI/ReadyAPI mocking functionality, so I'm not best placed to comment.  Some code snippets/screenshots of the validation may help someone else help you.

     

    Good luck,

     

    Chris

    • sonya_m's avatar
      sonya_m
      SmartBear Alumni (Retired)

      Thank you for the idea ChrisAdams !

       

      bflynnbyx did you solve this one? Please let us know!