Parse an SAP OData V2 XML atom:Feed
This is a work in progress!
The crate is designed to work in conjunction with the source code generated from the crate parse-sap-odata.
Crate parse-sap-odata is invoked by a Rust build script to parse an OData XML metadata file and generates the Rust structs and enums needed to consume the entity set data described by that metadata.
This crate parse-sap-atom-feed then makes use of the structs and enums generated above and allows your business app to consume the XML returned when requesting entity sets from this OData service.
Changes in V0.2
The main change in version 0.2 is to adopt quick-xml's @-prefixed attribute syntax introduced in 0.27 and higher.
Example Usage
You want to develop a Rust application that can consume the entity set data exposed by an SAP OData V2 service.
For the purposes of instruction, let's say you're working with a custom OData service that displays services ordered either by functional location or by date:
| Rust Application | zcustom-service-orders |
| OData Service URL | https://my-sap-server.my-domain.com/sap/opu/odata/sap |
| OData Service Name | ZCUSTOM_SERVICE_ORDERS_SRV |
| OData Schema Name | ZCUSTOM_SERVICE_ORDERS |
| Entity Names | SERVICE_ORDERS_BY_FLOCSERVICE_ORDERS_BY_DATE |
| Entity Type | ZServiceOrder |
The general approach to consuming such a service is as follows:
- Create a new Rust binary application
cargo new zcustom-service-orders cd zcustom-service-orders- Edit
Cargo.tomlto include at least the following dependenciesparse-sap-odata = "1.1" chrono = parse-sap-atom-feed = "0.2" quick-xml = rust_decimal = serde = uuid = mkdir odata- Display your service's metadata.
E.G.
https://my-sap-server.my-domain.com/sap/opu/odata/sap/ZCUSTOM_SERVICE_ORDERS_SRV/$metadata - Save the metadata as the file
zcustom_service_orders.xmlin theodatadirectory - Create a
build.rsfile in same directory asCargo.tomland add at least the following:use gen_src; - In
src/main.rsinclude at least:use ; include!; use *;
Change Log
| Version | Description |
|---|---|
| 0.2.5 | Read generic OData service document |
| 0.2.4 | Update Cargo.toml dependency versions |