Internal Server Error: Exception in SWP Servlet when calling service with POST request

45 views
Skip to first unread message

Nicolas Fouqué

unread,
Nov 25, 2021, 5:39:54 PM11/25/21
to TopBraid Suite Users
Hello, 
I have a SWP webservice taht is defined the most basically possible, it's a ui:JSONService and it is supposed to use a few parameters defined with spin:constraint : 
Argument directorysynchro:entityDirectoryGraph : rdfs:Resource
Argument directorysynchro:entityDirectoryZipFilePath : xsd:string

However, when I use Postman to send the following POST request : 
I instantly get this error

org.topbraid.core.servlet.HttpErrorException: Exception in SWP Servlet
at org.topbraidlive.swp.servlet.SWPServlet.run(SWPServlet.java:220)
at org.topbraidlive.swp.servlet.SWPServlet.run(SWPServlet.java:132)
at org.topbraidlive.swp.servlet.SWPServlet.run(SWPServlet.java:114)
at org.topbraidlive.swp.servlet.SWPServlet.doPost(SWPServlet.java:77)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
... Rest omitted
Caused by: java.lang.NullPointerException
at org.topbraid.spin.swp.servlet.SWPServletUtil.addParametersToScope(SWPServletUtil.java:585)
at org.topbraid.spin.swp.servlet.SWPServletUtil.addParametersToScope(SWPServletUtil.java:543)
at org.topbraid.spin.swp.servlet.SWPServletUtil.getView(SWPServletUtil.java:413)
at org.topbraid.spin.swp.servlet.SWPServletUtil.runUncached(SWPServletUtil.java:740)
at org.topbraid.spin.swp.servlet.SWPServletUtil.run(SWPServletUtil.java:729)
at org.topbraidlive.swp.servlet.SWPServlet.run(SWPServlet.java:180)
... 45 more

What's strange is that when I try to send the same request as a GET, the service does start (I get logs and ui:dumpScope), however the parameters are not properly bound (I check them with ui:dumpscope but they are all empty)

Holger Knublauch

unread,
Nov 25, 2021, 6:01:03 PM11/25/21
to topbrai...@googlegroups.com

Hi Nicolas,

please try the argument names without the prefix, e.g.

http://localhost:8083/tbl/swp?_viewClass=directorysynchro:_test_ImportDirectory_zipFile&entityDirectoryGraph=urn:x-evn-master:graph_in_edg&entityDirectoryZipFilePath=/project/filepath

The interpretation of spl:Arguments in SWP (and SPIN) is that only the local name part of the predicate will be used. So for ex:predicate you would use the parameter predicate without the ex:

HTH
Holger
--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/8ed2df51-2b1c-4a1e-b4ee-019be28002f9n%40googlegroups.com.

Nicolas Fouqué

unread,
Nov 26, 2021, 2:08:39 AM11/26/21
to TopBraid Suite Users
Hi Holger, 

Thank you for your help, I can now use GET requests with parameters, but I still get the same error when I try to use POST requests

Any idea why that might be ?

Thanks in advance,
Nicolas

Holger Knublauch

unread,
Nov 26, 2021, 2:47:16 AM11/26/21
to topbrai...@googlegroups.com
With POST requests, the SWP servlet expects the parameters to be part of the request body.

Holger


Reply all
Reply to author
Forward
0 new messages