Skip to Content
0

404 error when trying to call Servlet on deployed Java Service

Sep 25, 2017 at 01:51 PM

98

avatar image

Hello Community,

I'm developing a Java Service for the Sap Cloud Platform. It has a Servlet which overrides the doGet-Method and the doPost-Method. The Java Service is deployed on SCP.

I want to call this Servlet by making GET and POST-Requests from a SAPUI5 application to the Service. The SAPUI5 application is developed with the WebIDE and then also deployed on SCP. When starting the SAPUI5 application from the WebIDE its GET- and POST-Requests actually reach the Servlet on the deployed Java Service and everything works as intended, however after I deploy the SAPUI5 application to SCP and run it from there it receives a 404 error when making the GET-Request and a 405 error (Method not allowed) when making the POST-Request.

I have created a destination on SCP which points to the Java Service URL and use it in neo-app.json of the SAPUI5 application.

Any ideas why it works from the WebIDE but won't work after deployment?

Edit (additional information):

The requests are done by a sap.m.UploadCollection-Control (the Url is set in the uploadUrl attribute):

<UploadCollection id="UploadCollection" uploadUrl="/MyService/attachments/" ...>

Entry in neo-app.json:

{
	"path": "/MyService/attachments/",
	"target": {
		"type": "destination",
		"name": "MyService_Attachments"
	},
	"description": "MyService Attachments"
}

Destination Configuration in SCP Cockpit:

Name: MyService_Attachments
Type: HTTP
Description: MyService Attachments
URL: https://<JavaApplication><AccountName>.hana.ondemand.com/MyService/attachments
Proxy Type: Internet
Authentication: AppToAppSSO

<- Additional Properties ->
TrustAll: true
WebIDEEnabled: true
WebIDESystem: My Service

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Tobias Stelzer Sep 27, 2017 at 10:03 AM
0

I just found the problem and fixed it.

The app which accesses the Servlet is placed inside a Launchpad app which will open the app (and other apps).

After deployment of the individual apps the 'neo-app.json' of the Launchpad app is used, so I just had to define my Destination in there as well.

Share
10 |10000 characters needed characters left characters exceeded