Closed pvijeh closed 7 years ago
yes
Please open the api console http://localhost:8080 and try there the creation of a wishlist. Because you used "Authorization: Bearer token-token-token-token" this not needed. Only when you call the api proxy. There you can also see all the header fields which are required.
I am trying to construct a post request for this service-- but can't seem to create a successful one. Based on the api documentation, I have created this request:
curl -X POST -H "Authorization: Bearer token-token-token-token" -H "Content-Language: en" -H "Content-Type: application/json" -d '{ "id": "98hw85Y945e6U358", "url": "http://myApi.de/wishlists/98hw85Y945e6U358", "owner": "345MWyh7w4hY98W6", "title": "Floyds Birthday Wishlist", "description": "Bring on the presents", "createdAt": "2012-07-12T12:42:23.777Z", "items": [{ "product": "yKsU0y+PQUPgTIYm", "amount": "1", "note": "Always wanted a car", "createdAt": "2012-07-12T13:23:31.415Z"},{ "product": "ZdHErqRBhnJhJiVN", "amount": "4", "note": "Need some cool wheels for my new car", "createdAt": "2012-07-12T13:37:11.111Z" }]}' "http://localhost:8080/wishlists"
which results in a 500 server error:
16:57:20 [INFO ] [com.sap.wishlist.JerseyApplication] [] 101 Server has received a request on thread qtp654319391-17 101 > POST http://localhost:8080/wishlists 101 > Accept: /* 101 > Authorization: Bearer ***** 101 > Content-Language: en 101 > Content-Length: 497 101 > Content-Type: application/json 101 > Host: localhost:8080 101 > User-Agent: curl/7.43.0
16:57:20 [ERROR] [c.s.c.y.s.j.mappers.ThrowableMapper] [] Uncatched throwable occured: value is 'null'., responding with internal server error java.lang.NullPointerException: value is 'null'. at jersey.repackaged.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:226) ~[jersey-guava-2.22.2.jar:na] at org.glassfish.jersey.client.JerseyWebTarget.checkTemplateValues(JerseyWebTarget.java:301) ~[jersey-client-2.22.2.jar:na] at org.glassfish.jersey.client.JerseyWebTarget.resolveTemplates(JerseyWebTarget.java:266) ~[jersey-client-2.22.2.jar:na] at org.glassfish.jersey.client.JerseyWebTarget.resolveTemplates(JerseyWebTarget.java:259) ~[jersey-client-2.22.2.jar:na] at org.glassfish.jersey.client.JerseyWebTarget.resolveTemplates(JerseyWebTarget.java:59) ~[jersey-client-2.22.2.jar:na] at com.sap.cloud.yaas.rammler.commons.builder.AbstractActionBuilder.buildRequest(AbstractActionBuilder.java:153) ~[classes/:na] at com.sap.cloud.yaas.rammler.commons.builder.AbstractActionBuilder.execute(AbstractActionBuilder.java:83) ~[classes/:na] at com.sap.wishlist.customer.CustomerClientService.getCustomer(CustomerClientService.java:32) ~[classes/:na] at com.sap.wishlist.service.WishlistService.lambda$createWishlist$1(WishlistService.java:47) ~[classes/:na] at com.sap.cloud.yaas.servicesdk.authorization.integration.AuthorizedExecutionTemplate.executeAuthorized(AuthorizedExecutionTemplate.java:107) ~[service-sdk-authorization-4.11.0.jar:4.11.0] at com.sap.wishlist.utility.AuthorizationHelper.wrapWithAuthorization(AuthorizationHelper.java:30) ~[classes/:na] at com.sap.wishlist.service.WishlistService.createWishlist(WishlistService.java:46) ~[classes/:na] at com.sap.wishlist.api.generated.DefaultWishlistsResource.post(DefaultWishlistsResource.java:63) ~[classes/:na] at sun.reflect.GeneratedMethodAccessor121.invoke(Unknown Source) ~[na:na] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_102] at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_102] at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:160) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) ~[jersey-server-2.22.2.jar:na] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [jersey-common-2.22.2.jar:na] at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [jersey-common-2.22.2.jar:na] at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [jersey-common-2.22.2.jar:na] at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [jersey-common-2.22.2.jar:na] at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [jersey-common-2.22.2.jar:na] at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [jersey-common-2.22.2.jar:na] at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [jersey-server-2.22.2.jar:na] at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [jersey-server-2.22.2.jar:na] at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) [jersey-container-servlet-core-2.22.2.jar:na] at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [jersey-container-servlet-core-2.22.2.jar:na] at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [jersey-container-servlet-core-2.22.2.jar:na] at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [jersey-container-servlet-core-2.22.2.jar:na] at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [jersey-container-servlet-core-2.22.2.jar:na] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:835) [jetty-servlet-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1685) [jetty-servlet-9.3.7.v20160115.jar:9.3.7.v20160115] at com.sap.cloud.yaas.servicesdk.loggingfilters.LoggingContextFilter.doFilter(LoggingContextFilter.java:123) [service-sdk-logging-filters-4.11.0.jar:4.11.0] at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262) [spring-web-4.3.2.RELEASE.jar:4.3.2.RELEASE] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668) [jetty-servlet-9.3.7.v20160115.jar:9.3.7.v20160115] at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:209) [cors-filter-2.5.jar:2.5] at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:244) [cors-filter-2.5.jar:2.5] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668) [jetty-servlet-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581) [jetty-servlet-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [jetty-security-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1158) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511) [jetty-servlet-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1090) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:109) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:119) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.Server.handle(Server.java:517) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:308) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242) [jetty-server-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273) [jetty-io-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95) [jetty-io-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75) [jetty-io-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213) [jetty-util-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147) [jetty-util-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654) [jetty-util-9.3.7.v20160115.jar:9.3.7.v20160115] at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572) [jetty-util-9.3.7.v20160115.jar:9.3.7.v20160115] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_102] 16:57:20 [INFO ] [com.sap.wishlist.JerseyApplication] [] 101 * Server responded with a response on thread qtp654319391-17 101 < 500 101 < Content-Type: application/json
any ideas what is wrong with this request?