cancel
Showing results for 
Search instead for 
Did you mean: 

$metadata gets concatenated to OData URI...but why?

former_member199966
Discoverer
0 Kudos

Hi Experts,

Apologies up front if this question is placed in the wrong forum. I did research the issue, and became even more confused than before. I'm not a web dev. I'm just a simple abap dev (not an expert), with java/c# roots, who has also spent a little time with PI and basis. A jack of all trades, but master of none, if you will...

So... we've built an application and we're at the point where we need to replace mock data with data from the odata service. The NWGateway system is setup, and the connection works. The service URI looks like this:  '<host>:<port>/sap/opu/odata/SAP/Z_EMTIPPSPIEL_SRV'. The desired entity set (/TileCollection?) should be appended at runtime, when we call our dashboard.

The TileCollection entityset should call the method (in the DPC- generated by the gateway service builder) TILECOLLECTION_GET_ENTITYSET.
This method sends xml or json back. It works fine in the HTTP Request/Response tool. My data is returned and all is good in the world, birds sing, the sun is shining etc...

But, when I plug this URI (minus the TileCollection suffix) into my manifest, and run the application...the backend (somewhere...) concatenates a $metadata to my service URI. And I get no data.

I've researched the issue and know enough to be a danger to myself and those nearby. I found out that this isn't a bug, it's a feature!! [WHEW! Thank goodness!]

But wth...how do I get around this. The machine wants to get metadata for the query first. I'm cool with that. But how can I tell it to take the metadata and feed it to the wolves, so that I can call the service and get my TileCollection entity set.

Background info...
all views are xml views. The data binding is in the view. The entire thing was developed in WebIDE, cause I'm not really fluent in the magical world of javascript. I can understand what goes on in the simplest of code, and even compose a few lines...but the stuff that happens behind the curtain...js is just magic to me.

I'd be eternally grateful for any help, or shove in the right direction.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185414
Active Contributor
0 Kudos

Hi Sean,

I must say nicely put question .

The SAPUI5 framework is designed in an optimized way which prevents unnecessary backend  server calls. To support this a call for $metadata is always sent automatically as a prerequisite before firing other calls from applications to confirm whether the service is available. If the metadata call is successful then the remaining calls are triggered.

Another optimization which is done is the framework always fires a $count call to check the number of records available in any entity. If its non zero then the actual call to fetch the data is fired.

In your case, ideally if metadata call is going through and the count is non zero then data should come.

Can you please attach the screenshots of Network tab showing the calls and the errors(if any)/or data.

BR.

Answers (0)