Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hosted TripPinService does not support OData batch requests with BatchPayloadUriOption.RelativeUri #140

Open
NilsEngelbach opened this issue Apr 21, 2021 · 0 comments

Comments

@NilsEngelbach
Copy link

NilsEngelbach commented Apr 21, 2021

When using relative uris in the batch request content the provided hosted TripPin Service (https://services.odata.org/V4/TripPinServiceRW/) throws an internal server error:

{
  "error":{
    "code": "InternalServerError",
    "message": "The relative URI 'Airlines' was specified in a batch operation, but a base URI was not specified for the batch writer or batch reader.",
    "innererror":{
      "message": "The relative URI 'Airlines' was specified in a batch operation, but a base URI was not specified for the batch writer or batch reader.",
      "type": "Microsoft.OData.Core.ODataException",
      "stacktrace": "at Microsoft.OData.Core.ODataBatchUtils.CreateOperationRequestUri(Uri uri, Uri baseUri, IODataUrlResolver urlResolver)
          at Microsoft.OData.Core.ODataBatchReader.ParseRequestLine(String requestLine, String& httpMethod, Uri& requestUri)
          at Microsoft.OData.Core.ODataBatchReader.CreateOperationRequestMessageImplementation()
          at Microsoft.OData.Core.ODataBatchReader.InterceptException[T](Func`1 action)
          at Microsoft.OData.Core.ODataBatchReader.CreateOperationRequestMessage()
          at Microsoft.Test.OData.Services.ODataWCFService.Handlers.BatchHandler.Process(IODataRequestMessage requestMessage, IODataResponseMessage responseMessage)
          at Microsoft.Test.OData.Services.ODataWCFService.Handlers.RequestHandler.Process(Stream requestStream)
          at Microsoft.Test.OData.Services.ODataWCFService.Handlers.RequestHandler.Process(Stream requestStream)
          at Microsoft.Test.OData.Services.ODataWCFService.Handlers.RootRequestHandler.Process(Stream requestStream)"
    }
  }
}

When running the service locally it works fine.

Example Batch Payloads

POST http://localhost:23890/$batch HTTP/1.1

Absolute uris local service

--batch_ac4d9fb4-e4de-4c1f-9153-0d9308720072
Content-Type: application/http
Content-Transfer-Encoding: binary

GET http://localhost:23890/Airlines HTTP/1.1

--batch_ac4d9fb4-e4de-4c1f-9153-0d9308720072
Content-Type: multipart/mixed; boundary=changeset_f4ba15a3-29f2-423a-811c-d7684cd360aa

--changeset_f4ba15a3-29f2-423a-811c-d7684cd360aa
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2

POST http://localhost:23890/Airlines HTTP/1.1
Content-ID: 2
Prefer: return=minimal
OData-Version: 4.0
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8

{"@odata.type":"#ODataSamples.WebApiService.Models.Airline","AirlineCode":"TT","Name":"Test Airline"}
--changeset_f4ba15a3-29f2-423a-811c-d7684cd360aa--
--batch_ac4d9fb4-e4de-4c1f-9153-0d9308720072
Content-Type: application/http
Content-Transfer-Encoding: binary

GET http://localhost:23890/Airlines HTTP/1.1

--batch_ac4d9fb4-e4de-4c1f-9153-0d9308720072--

Relative uris local service

--batch_69819926-ba2a-4e59-87e7-768c0397e18c
Content-Type: application/http
Content-Transfer-Encoding: binary

GET Airlines HTTP/1.1

--batch_69819926-ba2a-4e59-87e7-768c0397e18c
Content-Type: multipart/mixed; boundary=changeset_f90e0431-9b28-4373-93a7-b78ca7e2e321

--changeset_f90e0431-9b28-4373-93a7-b78ca7e2e321
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2

POST Airlines HTTP/1.1
Content-ID: 2
Prefer: return=minimal
OData-Version: 4.0
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8

{"@odata.type":"#ODataSamples.WebApiService.Models.Airline","AirlineCode":"TT","Name":"Test Airline"}
--changeset_f90e0431-9b28-4373-93a7-b78ca7e2e321--
--batch_69819926-ba2a-4e59-87e7-768c0397e18c
Content-Type: application/http
Content-Transfer-Encoding: binary

GET Airlines HTTP/1.1

--batch_69819926-ba2a-4e59-87e7-768c0397e18c--

POST https://services.odata.org/V4/(S(tlqsblnqc325d3g3fkcdjfnn))/TripPinServiceRW/$batch HTTP/1.1

Absolute uris hosted service

--batch_894c7175-9339-4d01-9e79-fb04e8955c59
Content-Type: application/http
Content-Transfer-Encoding: binary

GET https://services.odata.org/V4/(S(shvevt0np51k15lzg4kfwka5))/TripPinServiceRW/Airlines HTTP/1.1

--batch_894c7175-9339-4d01-9e79-fb04e8955c59
Content-Type: multipart/mixed; boundary=changeset_140b70f2-4960-45be-8867-b79b22038d52

--changeset_140b70f2-4960-45be-8867-b79b22038d52
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2

POST https://services.odata.org/V4/(S(shvevt0np51k15lzg4kfwka5))/TripPinServiceRW/Airlines HTTP/1.1
Content-ID: 2
Prefer: return=minimal
OData-Version: 4.0
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8

{"@odata.type":"#Microsoft.OData.SampleService.Models.TripPin.Airline","AirlineCode":"TT","Name":"Test Airline"}
--changeset_140b70f2-4960-45be-8867-b79b22038d52--
--batch_894c7175-9339-4d01-9e79-fb0
4e8955c59
Content-Type: application/http
Content-Transfer-Encoding: binary

GET https://services.odata.org/V4/(S(shvevt0np51k15lzg4kfwka5))/TripPinServiceRW/Airlines HTTP/1.1

--batch_894c7175-9339-4d01-9e79-fb04e8955c59--

Relative uris hosted service

--batch_f21a5821-749e-4be7-9274-1df9551d7957
Content-Type: application/http
Content-Transfer-Encoding: binary

GET Airlines HTTP/1.1

--batch_f21a5821-749e-4be7-9274-1df9551d7957
Content-Type: multipart/mixed; boundary=changeset_877fc302-a9bd-4242-a3b1-6a2963275af7

--changeset_877fc302-a9bd-4242-a3b1-6a2963275af7
Content-Type: application/http
Content-Transfer-Encoding: binary
Content-ID: 2

POST Airlines HTTP/1.1
Content-ID: 2
Prefer: return=minimal
OData-Version: 4.0
Content-Type: application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8

{"@odata.type":"#Microsoft.OData.SampleService.Models.TripPin.Airline","AirlineCode":"TT","Name":"Test Airline"}
--changeset_877fc302-a9bd-4242-a3b1-6a2963275af7--
--batch_f21a5821-749e-4be7-9274-1df9551d7957
Content-Type: application/http
Content-Transfer-Encoding: binary

GET Airlines HTTP/1.1

--batch_f21a5821-749e-4be7-9274-1df9551d7957--

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant