Symptome
- Standard SAP OData Adapter kann nicht mit JSON POST Payloads umgehen
- Atom XML wird nicht vom Backend akzeptiert, z.B. beim BillOfMaterial v0002 Service
Voraussetzungen
- Zugriff auf SAP Integration Suite
- Credentials für das SAP Backend-System
API_BILL_OF_MATERIAL_SRVoder vergleichbarer OData Service
Schrittweise Konfiguration
Konfiguration des iFlows
- Neuen iFlow anlegen
- Runtime Configuration öffnen
- Parameter
HTTP Session ReuseaufOn Exchangesetzen
Die Einstellung sorgt dafür, dass CSRF-Token und Session-ID korrekt gesichert werden und im POST Request zur Verfügung stehen.
Aufbau des iFlows
1. Content Modifier: Header für CSRF-Token Request
Setzen von zwei Header-Parametern:
accept: application/jsonx-csrf-token: fetch
2. HTTP GET Adapter: CSRF-Token abrufen
- Adresse konfigurieren, z.B.
API_BILL_OF_MATERIAL_SRV;v=0002/MaterialBOM - Query Parameter hinzufügen:
$top=1 - Credentials für Backend-System hinterlegen
- Request Headers eintragen:
x-csrf-token|accept
3. Content Modifier: Cookie speichern
Setzen von einem Header-Parameter:
Cookie: set-cookie(Source Type: Header)
4. HTTP POST Adapter: POST Request ausführen
- Adresse konfigurieren, z.B.
API_BILL_OF_MATERIAL_SRV;v=0002/MaterialBOM - Credentials für Backend-System hinterlegen
- Request Headers eintragen:
x-csrf-token|Cookie
Prozess
sequenceDiagram participant Client participant iFlow participant ContentMod1 as Content Modifier 1 participant HTTPGet as HTTP GET Adapter participant ContentMod2 as Content Modifier 2 participant HTTPPost as HTTP POST Adapter participant Backend as SAP Backend Client->>iFlow: JSON POST Request iFlow->>ContentMod1: Process Request ContentMod1->>ContentMod1: Set Headers:<br/>accept: application/json<br/>x-csrf-token: fetch ContentMod1->>HTTPGet: Forward with Headers HTTPGet->>Backend: GET /MaterialBOM?$top=1<br/>Headers: x-csrf-token, accept Backend->>HTTPGet: Response with CSRF-Token<br/>and Set-Cookie HTTPGet->>ContentMod2: Pass Response ContentMod2->>ContentMod2: Set Header:<br/>Cookie: set-cookie ContentMod2->>HTTPPost: Forward with Token & Cookie HTTPPost->>Backend: POST /MaterialBOM<br/>Headers: x-csrf-token, Cookie<br/>Body: JSON Payload Backend->>HTTPPost: Success Response HTTPPost->>iFlow: Return Response iFlow->>Client: Final Response