Skip to Content

Error during WebSocket handshake: Unexpected response code: 403

Hello everyone,

I want to implement a notification system in my SAPUI5 application developed with SAP Web IDE.

So I followed the steps described in these blogs ABAP Channels Part 1 , ABAP Channels Part 2 , ABAP Channels Part 3, and I also tried this blog Real time push notification in SAP ABAP.

But I get this error message while connecting to APC with websocket :

WebSocket connection to 'wss://webidetesting******-fiori.dispatcher.int.sap.eu2.hana.ondemand.com/sap/bc/apc/sap/ztest_apc' failed: Error during WebSocket handshake: Unexpected response code: 403

Can anyone help me please.

This is my JS code

var hostLocation = window.location, socket, socketHostURI, webSocketURI;
			
if (hostLocation.protocol === "https:") 
  socketHostURI ="wss:"; 
else
  socketHostURI = "ws:";				
  socketHostURI += "//" + hostLocation.host;
  webSocketURI = socketHostURI + "/sap/bc/apc/sap/ztest_apc" ;
			
  socket = new WebSocket(webSocketURI);
		
  socket.onopen = function() {};
			
  socket.onmessage = function(message) {
     sap.m.MessageBox.show(message.data);
  }

};

  socket.onclose = function() {};
Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Jul 18, 2020 at 07:51 AM

    I tried to put the backend URI instead of webSocketURI variable like the code below but I get also the same error.

    socket = new WebSocket("wss://ldciofd.mo.sap.corp:44378/sap/bc/apc/sap/zapc_test");
    
    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on 12 hours ago

    Hi Walid,

    Were you able to resolve this issue? I am also facing a similar issue. Could you please share some details.

    Thanks

    Ravindra

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.