If you have questions or if you want to share your opinion about Aware IM post your message on this forum
#53373 by BobK
Tue Mar 03, 2020 6:55 pm
How do you use "URL must contain string" when exposing a REST Service?

I have a BSV named Test
A Service that exposes a REST service called TestInURL
This service accepts 1 piece of Plain Text data into an attribute called TheData

Without "URL must contain string"
The URL: http://localhost:8080/AwareIM/REST/Test/TestInUrl?TheData=test+input+data
works.

If I add "HI/BOB" to the "URL must contain string"
and put a text file called rest.props into the AwareIM/bin directory
and the text file contains DOMAIN=Test
The following URL does not work:

http://localhost:8080/AwareIM/HI/BOB?TheData=test+input+data
The following error was returned:
HTTP Status 404 – Not Found
Type Status Report
Message /AwareIM/HI/BOB
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


I also tried the following URLs which also did not work:

http://localhost:8080/AwareIM/HI/BOB/TestInUrl?TheData=test+input+data
the following error was returned:
HTTP Status 404 – Not Found
Type Status Report
Message /AwareIM/HI/BOB/TestInUrl
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


http://localhost:8080/AwareIM/REST/HI/BOB/TestInUrl?TheData=test+input+data
the following error was returned:
HTTP Status 500 – Internal Server Error
Type Exception Report
Message com.bas.connectionserver.server.AccessDeniedException
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
#53452 by BobK
Tue Mar 10, 2020 3:22 pm
Still not working using build 2718

URL
http://localhost:8080/AwareIM/REST/HI/BOB?TheData=test+input+data

Generates in the Server Output
Unable to determine business space version for user

Tomcat output
REST Servlet (GET) called
Connecting to server localhost at port 9000
com.bas.connectionserver.server.AccessDeniedException
at com.bas.connectionserver.server.ConnectionFactory.createLocalSocketConnection(ConnectionFactory.java:148)
at com.bas.webapp.common.WebAppUtils.logonToServer(Unknown Source)
at com.bas.webapp.common.WebAppUtils.A(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.A(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Mar 09, 2020 12:28:56 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [RESTServlet] in context with path [/AwareIM] threw exception [com.bas.connectionserver.server.AccessDeniedException] with root cause
com.bas.connectionserver.server.AccessDeniedException
at com.bas.connectionserver.server.ConnectionFactory.createLocalSocketConnection(ConnectionFactory.java:148)
at com.bas.webapp.common.WebAppUtils.logonToServer(Unknown Source)
at com.bas.webapp.common.WebAppUtils.A(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.A(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
#53484 by BobK
Mon Mar 16, 2020 9:38 pm
aware_support wrote:This can only indicate a problem in determining the business space of the request. Are you sure that you have the correct property file and that the business space has a published version?


Yes I am sure the BSV is published an the property file is correct.
#53493 by BobK
Tue Mar 17, 2020 5:58 pm
Jaymer,

I am working on integrating with a third party and data is being passed in both directions.

When I send data to this third party, their URL is something like
https://server/path/<account number>
with json data in the body of the request.

My application is multi tenant, so the account number could be one of several possible values.
I have no problem building that type of URL for sending them data. The problem is that I did not know how to create a service in AwareIM, that this third party would be sending data to, where some part of the URL would contain one of several different possible values (depending upon which one of my tenants the data was for).

In another post, AwareIM Support suggested using the "URL must contain string" option in the REST settings of exposed services.

HI/BOB was just the required string I was using in my investigation of how this option works. In production I would create a service for each of my clients and replace HI/BOB with their account number.

When I could not get this option to work, I created this thread.
#53741 by BobK
Fri Apr 17, 2020 12:11 pm
It turns out that I do not need this functionality, and I guess no one else does either.
But if this functionality is going to be provided by AwareIM, it should work as advertised.

If the URL must contain the string: "someName1/someName2", The User Guide states to use a URL like:
http://ServerName:port/AwareIM/someName1/someName2?parameters
This does not work and the Client receives:
HTTP Status 404 – Not Found
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.


Earlier in this thread, support stated:
aware_support wrote:It's probably a deficiency of the documentation. The URL that contains your string should also contain REST in the path

So, I tried:
http://ServerName:port/AwareIM/REST/someName1/someName2?parameters
This also did not work and the Client received:
HTTP Status 500 – Internal Server Error
The server encountered an unexpected condition that prevented it from fulfilling the request.

Server log also contained:
Unable to determine business space version for user


I also tried adding the extension .json for a URL something like:
http://ServerName:port/AwareIM/someName1/someName2.json?parameters
This Worked but is not documented anywhere. I only stumbled upon this format because of some experimentation and I knew where to look because of my prior experience in web development.

Since using a .json extension works, that proves that I have everything else set up correctly.
So, the question is: why do the documented URLs (the first 2 above) not work?
#53910 by BobK
Wed May 13, 2020 2:21 pm
From the changelog for build 2722:
5. "URL must contain string" option in REST services didn't work properly

:D

Sadly, it still does not work. :cry:


A URL like http://ServerName:port/AwareIM/someName1/someName2?parameters
Nothing displays in any of the logs.
The following us returned to the client
HTTP Status 404 – Not Found
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.



A URL like http://ServerName:port/AwareIM/REST/someName1/someName2?parameters
The Server Output contains
Unable to determine business space version for user

The Tomcat Output contains
REST Servlet (GET) called
Connecting to server localhost at port 9000
com.bas.connectionserver.server.AccessDeniedException
at com.bas.connectionserver.server.ConnectionFactory.createLocalSocketConnection(ConnectionFactory.java:148)
at com.bas.webapp.common.WebAppUtils.logonToServer(Unknown Source)
at com.bas.webapp.common.WebAppUtils.A(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.A(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
May 12, 2020 3:45:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [RESTServlet] in context with path [/AwareIM] threw exception [com.bas.connectionserver.server.AccessDeniedException] with root cause
com.bas.connectionserver.server.AccessDeniedException
at com.bas.connectionserver.server.ConnectionFactory.createLocalSocketConnection(ConnectionFactory.java:148)
at com.bas.webapp.common.WebAppUtils.logonToServer(Unknown Source)
at com.bas.webapp.common.WebAppUtils.A(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.common.WebAppUtils.logon(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.A(Unknown Source)
at com.bas.webapp.thin.servlets.RESTServlet.doGet(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:635)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:803)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:790)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1459)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Last edited by BobK on Wed May 13, 2020 7:15 pm, edited 1 time in total.
#53913 by Jaymer
Wed May 13, 2020 10:19 pm
I don’t think the first one will ever work. Nothing to “activate” the rest servlet. That’s why it’s has to be in \REST
#53914 by BobK
Wed May 13, 2020 10:30 pm
Jaymer wrote:I don’t think the first one will ever work. Nothing to “activate” the rest servlet. That’s why it’s has to be in \REST


I totally agree, but that is the format described in the Users Guide.

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 16 guests