Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

$Batch Request error with Transaction Notification

cognnav
Discoverer
0 Likes
1,321
  • SAP Managed Tags

Hi, I want to create a new delivery note by $batch request. My request body is:

--Batch_Header
Content-Type: multipart/mixed;boundary=Batch_Body


--Batch_Body
Content-Type: application/http 
Content-Transfer-Encoding:binary
Content-ID: 1


POST /b1s/v1/DeliveryNotes
Content-Type: application/json


<Json format Content>


--Batch_Body--
--Batch_Header--

It works perfect until I create a notification for DeliveryNotes (edit store prodecure SBO_SP_TransactionNotification) like this:

AlTER PROCEDURE SBO_SP_TransactionNotification
(
in object_type nvarchar(30), -- SBO Object Type
in transaction_type nchar(1),-- [A]dd, [U]pdate, [D]elete, [C]ancel, C[L]ose
in num_of_cols_in_key int,
in list_of_key_cols_tab_del nvarchar(255),
in list_of_cols_val_tab_del nvarchar(255)
)
LANGUAGE SQLSCRIPT
AS
-- Return values
error  int;-- Result (0 for no error)
error_message nvarchar (200); -- Error string to be displayed
begin
error := 0;
error_message := N'OK';
if :object_type = '15' then -- 15 is object type of Delivery Note
    error := 1;
    error_message := N'Error';
end if;
-- Select the return values
select :error, :error_message FROM dummy;
end;

Now when i send request, the response does not return something like {"error": 1, "error_message": "Error"} but:

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
 <title>502 Proxy Error</title>
</head>
<body>
 <h1>Proxy Error</h1>
 <p>The proxy server received an invalid
 response from an upstream server.<br />
The proxy server could not handle the request <em><a href="/b1s/v1/$batch">POST /b1s/v1/$batch</a></em>.<p>
 Reason: <strong>Error reading from remote server</strong></p>
 </p>
</body>
</html> 

Please tell me What 's wrong.

2 REPLIES 2
Read only

hnavarro
Discoverer
0 Likes
1,077
  • SAP Managed Tags

I have a similiar error, too.

when I try to perform a transaction by scriptengine or batch, and this operation triggers a validation by sp transaction notification, it returns proxy error 502.

What happen?

Read only

0 Likes
1,077
  • SAP Managed Tags

Did you have solution for this error?