Hello SDN!
This is my XSOData service:
service namespace "developers.kulaev.indexes.services.odata" { "developers.kulaev.indexes.db::DATA.IND.ZLIB_IND_BASE" as "IndexBase" navigates("Index_Busas" as "IndBusas") create events( before "developers.kulaev.indexes.js.ue:ind.xsjslib::createIndRecBE" ) delete forbidden; "developers.kulaev.indexes.db::DATA.IND.ZLIB_IND_BUSAS" as "Busas" delete forbidden; association "Index_Busas" principal "IndexBase"("ID") multiplicity "1" dependent "Busas"("IND_ID.ID") multiplicity "*" update events (before "developers.kulaev.indexes.js.ue:ind.xsjslib::linkIndBusa" ) delete forbidden; }
ZLIB_IND_BASE has one key field ("ID"), which generates with create event createIndRecBE. ZLIB_IND_BUSAS has two key fields - ID from ZLIB_IND_BASE and ROW_NUMBER. During creation I have to generate key value for ZLIB_IND_BASE (done), fill ROW_NUMBER with counter values (don't know how to realize it in user-exit; done in UI) and set this key for created record(s) in ZLIB_IND_BUSAS via using the $link operation.
I created the followed request:
--batch Content-Type:multipart/mixed;boundary=changeset Content-Transfer-Encoding:binary --changeset Content-Type:application/http Content-Transfer-Encoding:binary Content-ID: 1 POST IndexBase HTTP/1.1 Content-Type: application/json Content-Length:82 {"MANDT":"300","ID":"","RQST":"X","IND_CODE":"","NAME":"demo123","SHORT_NAME":"a"} --changeset Content-Type:application/http Content-Transfer-Encoding:binary Content-ID: 2 POST Busas HTTP/1.1 Content-Type:application/json Content-Length:45 {"IND_ID.ID":"","ROW_NUM":0,"BUS_AREA_ID":15} --changeset Content-Type:application/http Content-Transfer-Encoding:binary PUT $1/$links/IndBusas HTTP/1.1 Content-Type:application/json Content-Length:12 {"uri":"$2"} --changeset-- --batch--
IfI use PUT $1/$links/IndBusas HTTP/1.1 then I get an error:
HTTP/1.1 405 Method Not Allowed Content-Type: application/json Content-Length: 168 { "error": { "code": "", "message": { "lang": "en-US", "value": "The URI is not valid for PUT operation. The URI must point to a single resource for PUT operations."}}}
If I use POST $1/$links/IndBusas HTTP/1.1 then I get an error:
HTTP/1.1 400 Bad Request Content-Type: application/json Content-Length: 95 { "error": { "code": "", "message": { "lang": "en-US", "value": "Modification not possible."}}}
How can I resolve this problem?
Regards,
Lev