We’re experiencing critical issues with our ECN webservice integration when updating BOMs. The MES system sends JSON payloads to create ECN changes with BOM modifications, but requests fail with ‘Invalid JSON payload’ errors. This is blocking our production updates.
Our webservice calls were working fine until last week. The JSON schema validation appears to reject our payload format even though we haven’t changed the structure:
{
"ecn": "ECN-2024-0156",
"bomItems": [{"item":"P-10234","qty":5}]
}
The error occurs specifically when the payload includes BOM item updates. Simple ECN creation without BOM changes works fine. We’re on Agile 9.3.4 with latest patches. Has anyone encountered similar webservice API error handling issues with MES payload formatting?
Thanks for the suggestions. I verified the Content-Type header is correct. I tried adding changeType field but still getting the same error. The logs show ‘Schema validation failed at bomItems[0]’ but don’t specify what’s wrong with the structure.
Check your BOM item reference format carefully. In 9.3.4, the webservice expects the full object structure with proper type definitions. Your simplified format might be the issue. Also, ensure your MES system is sending proper encoding for special characters in item numbers. We had similar problems with UTF-8 encoding mismatches causing schema validation failures that showed generic ‘Invalid JSON’ errors.
I encountered this exact issue last month. The problem is the BOM item structure changed in 9.3.4. You need to include additional metadata fields. Also verify your error handling is capturing the full validation response - Agile often returns detailed schema errors in a nested error object that generic handlers miss.
Your issue is definitely the payload structure. After analyzing your code and the 9.3.4 schema requirements, here’s what you need to fix:
JSON Schema Validation Issue:
The ECN webservice in 9.3.4 requires a more complete BOM item structure. Your current format is too simplified. The schema now validates against these mandatory fields:
{
"ecn": "ECN-2024-0156",
"bomItems": [{
"item": {"number": "P-10234"},
"quantity": {"value": 5, "unit": "EA"},
"changeType": "MODIFY"
}]
}
Webservice API Error Handling:
The error message you’re seeing is generic because the webservice’s error response includes nested details that your integration isn’t capturing. Modify your error handling to parse the ‘validationErrors’ array in the response body - it contains specific field-level failures.
MES Payload Formatting:
Your MES system needs to be updated to send the expanded format. The key changes:
- Item references must be objects with ‘number’ property, not plain strings
- Quantity requires both ‘value’ and ‘unit’ (EA, KG, etc.)
- ChangeType is mandatory: ADD, MODIFY, or REMOVE
- Ensure proper JSON escaping for item numbers with special characters
Implementation Steps:
// Pseudocode - MES payload transformation:
1. Transform item string to object: {"number": itemNumber}
2. Wrap quantity value: {"value": qty, "unit": "EA"}
3. Add changeType based on operation (default "MODIFY")
4. Validate against updated schema before sending
5. Parse nested validationErrors array from 4xx responses
After making these changes, test with a single BOM item first. The webservice will now properly validate and accept your updates. Also consider implementing request/response logging to capture the full error details - this helps diagnose future schema validation issues quickly.
One more tip: if you’re processing bulk updates, implement proper batching with retry logic. We found that large BOM updates can timeout even with correct payloads, so breaking them into smaller batches (10-15 items) with exponential backoff on failures works best.
I’ve seen this before. Check your Content-Type header first - it should be application/json. Also verify the API endpoint version hasn’t changed. Sometimes after patches the webservice expects different payload structures for BOM updates.
The ‘Invalid JSON payload’ error in ECN webservices typically relates to schema validation rules. Agile 9.3.4 introduced stricter validation for BOM item references. Your payload structure looks correct, but you might be missing required fields. Try adding the ‘changeType’ field for each BOM item - it’s mandatory in the updated schema even though the documentation doesn’t clearly state this. Also check if your item numbers need the full object reference format instead of just the number string.