Visualize SAP Gateway OData services
SAP NetWeaver Gateway OData services can contain a comprehensive set of entity types and associations. A visual representation can help you understand and communicate the contents of a SAP Gateway OData service.
In this post I will describe how you can explore SAP Gateway OData services, using the Open Data Protocol Visualizer, a free extension for Visual Studio 2010.
Installing the OData Protocol Visualizer in VS2010
The Open Data Protocol Visualizer is a Visual Studio 2010 extension, which you can install via the Extension manager.
Launch the “Extension Manager” from the Visual Studio “Tools” menu.
The visualizer is available from the online gallery, in the Tools>Data section:
Click to download and install. Restart Visual Studio and you’re done!
Configure a SAP Gateway service
Let’s use the ubiquitous Flight service on the SAP Gateway demo system as an example. You will need the demo username/password, provided on this page.
The service URL for the Flight service is:
http://gw.esworkplace.sap.com/sap/opu/odata/IWBEP/RMTSAMPLEFLIGHT_2/
To use the OData visualizer, you need to create a project in VS and include a Service Reference to an OData service:
First, create (for example) a Console project. In the Service References section, right-click and select ‘”Add Service Reference”:
In the dialog box, enter the service Url in the Address field and provide a meaningful name in the Namespace field. Click on Go and provide the demo username and password. Visual Studio will now download the service information ($metadata). Once completed, you should now be able to expand the Service header and see the collections available through the Flight service.
Click OK, and the Service is available for use in your project
Visualize SAP Gateway service
To start using the visualizer, right-click the Service reference and click ‘View in Diagram”
This opens the visualizer window. In the left pane, you will find a model browser, which lists Entity types, Associations, Complex Types and their Attributes. The center pane contains a ‘canvas’ where you select and layout the visual representation of the model.
A detailed view of the Flight and Booking entity types:
The OData visualizer has several useful features:
- layout: determine how the shapes are visually arranged
- zoom in/out: canvas can be zoomed in and out.
- collapsed view: just shows entity types and associations, no attributes
- select/deselect: determine which part of the ‘model’ you want to visualize
- view in browser: automatically open the collection for a selected Entity type. E.g. View ‘Booking’ in browser will request the BookingCollection from the Flight service.
- export to XPS: export the content to XPS file format (unfortunately no other file format is supported…).
Here’s an example of a collapsed (partial) view of the Activity Management service (based on SAP CRM):
Finally, here’s an example of the properties pane showing the attribute properties of the Value attribute of a Sales Order Item.
The OData visualizer can be a valuable part of your toolbox. Give it a try!
Thanks for reading.
Does it work for complex OData objects used in parameters of function imports (OData 3.0)?
The OData Protocol Visualizer can deal with complex OData types (nesting etc). But at the moment it hasn't been upgraded to support full OData 3.0
Unfortunatly, this won't work for me. I see at least the following errors and warnings:
The custom tool 'DataServiceClientGenerator' failed. Data service client code-generation failed: Schema specified is not valid. Errors:
(0,0) : warning 0005: Could not find schema information for the attribute 'rel'.
(0,0) : warning 0005: Could not find schema information for the attribute 'href'.
(0,0) : warning 0005: Could not find schema information for the attribute 'rel'.
(0,0) : warning 0005: Could not find schema information for the attribute 'href'.
(0,0) : error 0129: The property 'GUID' in EntityType 'MRSS_SRV.DemandHeaderStatus' is not valid. EntityKey properties that are of type 'Binary' are currently not supported.
(0,0) : error 0129: The property 'GUID' in EntityType 'MRSS_SRV.DemandItemStatus' is not valid. EntityKey properties that are of type 'Binary' are currently not supported.
(0,0) : error 0129: The property 'RESOURCE_KEY' in EntityType 'MRSS_SRV.ClockData' is not valid. EntityKey properties that are of type 'Binary' are currently not supported.
(0,0) : error 0129: The property 'DEMAND_KEY' in EntityType 'MRSS_SRV.ClockData' is not valid. EntityKey properties that are of ....
This is rather unfortunate.
Regards,
Wolfgang
Did you know, that this can also easily done via an eclipse plugin, that is offered by SAP?
https://tools.hana.ondemand.com/#gateway
called OData Modeller
The plugin can import the metadata.xml from uri and visualize it inside eclipse.
If your are developing SAP OpenUI5 or SAP HANA inside eclipse, you do not need an addtional tool.
We use it also for documentation.
Best regards
Holger