on 01-31-2017 10:27 AM
I am trying to make a batch call to a function import with method POST and I am getting the following error:
The specified HTTP method is not allowed for the resource identified by the Data Service Request URI
When I call the function import in a single call it works so I guess the issue is in how I am trying to address it as a batch call.
My HTTP URL:
/sap/opu/odata/SAP/ZMYSERVICE_SRV/$batch
My HTTP request header:
Content-Type: multipart/mixed; boundary=batch
My HTTP request body:
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST PutSomethingIntoSomeplace?ThingID='00000190111201000001'&PlaceID='0000309893'
POST PutSomethingIntoSomeplace?ThingID='00000190111201000002'&PlaceID='0000309893'
--changeset--
--batch--
I have also redefined methods:
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_BEGIN
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_END
/IWBEP/IF_MGW_APPL_SRV_RUNTIME~CHANGESET_PROCESS
Thanks in advance.
My bad: it seems it was (as usual) a formatting issue in the request body. I'll leave it here before I close the question, in case someone may find it useful:
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST PutSomethingIntoSomeplace?ThingID='00000190111201000001'&PlaceID='0000309893' HTTP/1.1
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST PutSomethingIntoSomeplace?ThingID='00000190111201000002'&PlaceID='0000309893' HTTP/1.1
--changeset--
--batch--
It's kind of a hell when you are trying to test this sort of things in the Gateway Client and you have no js library at hand to format the request...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you please answer the following questions:
I am a little bit desperate at the moment because nothing seems to work.
I am at the point, where I have a request, that does not get rejected from the gateway. But breakpoints in CHANGESET_BEGIN and EXECUTE_ACTION do not work. It seems as if the gateway is doing nothing.
If I access the function import directly then it I get the error, that the HTTP method is not supported for the function import. But I chose POST in SEGW.
I chose the following settings in SEGW:
Name: ExampleFunctionImport
Return Type: EntityType
Return EntityType: ExampleEntity
Return Cardinality: 0...n
Return EntitySet: ExampleEntitySet
HTTP Method: POST
Action for Entity Type: ExampleEntity
Here is the request, that I created in the Gateway Client:
--batch
Content-Type: multipart/mixed; boundary=changeset
Content-Length: ###
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST ExampleFunctionImport?DocumentId=guid'000C2924-ADF5-1ED6-B8C5-114D644A743D' HTTP/1.1
--changeset--
--batch--
Here is the answer from the gateway (HTTP Status 202 - Accepted):
--9CA6B637F41B3AA5F004A8A02A32E39C0
Content-Type: multipart/mixed
Content-Length: 0
--9CA6B637F41B3AA5F004A8A02A32E39C0--
What am I missing?
Really looking forward to an answer,
Hendrik
I created a testservice to test further.
It is possible to use the function import alone by calling
POST /sap/opu/odata/SAP/Z_GW_TEST_SRV/DoWhateverInPost?Par1="Test"&Par2="Test2"
The breakpoint in EXECUTE_ACTION is triggered.
If I try to call
POST /sap/opu/odata/SAP/Z_GW_TEST_SRV/$batch
with the following request body
--batch
Content-Type: multipart/mixed; boundary=changeset
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST DoWhateverInPost?Par1='Blabla'&Par2='BluBlu' HTTP/1.1
--changeset
Content-Type: application/http
Content-Transfer-Encoding: binary
POST DoWhateverInPost?Par1='Blabla'&Par2='BluBlu' HTTP/1.1
--changeset
--batch--
NOTHING happens.
However I get the following response (202):
--69B16AD14CC8982FD6CA01193EF335370
Content-Type: multipart/mixed
Content-Length: 0
--69B16AD14CC8982FD6CA01193EF335370--
The metadata of the function import looks as follows:
<FunctionImport Name="DoWhateverInPost" EntitySet="Tests" m:HttpMethod="POST" ReturnType="Z_GW_TEST_SRV.Test" sap:action-for="Z_GW_TEST_SRV.Test">
<Parameter Name="Par2" Type="Edm.String" Mode="In"/>
<Parameter Name="Par1" Type="Edm.String" Mode="In"/>
</FunctionImport>
I refreshed the metadata multiple times.
Can you please post how your function import looks in SEGW?
User | Count |
---|---|
68 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.