I have the validation working just fine. My question is, when you receive a validation error how come the element causing the issue is not provided. Below is a error I got for a invalid phone number, it does not mention the element name nor they type it is violating.
Message-Validation-1 failed with reason: \"Value doesnt match the regular expression mentioned in the type\"",
Is there some setup I am missing or is that as good as it gets. Right now the message has no value to anyone.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <MessageValidation name="Validation" enabled="true" continueOnError="false" async="false"> <DisplayName>Validation</DisplayName> <Properties/> <Source>request</Source> <ResourceURL>xsd://SubscriberInquiry.xsd</ResourceURL> </MessageValidation>
Yes, the built-in MessageValidation policy is limited in that way. It's a YES/NO sort of thing.
If you want more helpful messages you can try an existing callout policy I wrote. Find it here.
curl -i -H content-type:application/xml https://$ORG-$ENV.apigee.net/java-xsd/t1 -d '<purchaseOrder xmlns="http://tempuri.org/po.xsd" orderDate="2018-07-09"> <name>Alice Smith</name> <street>123 Maple Street</street> <city>Mill Valley</city> <state>CA</state> <zip>90952</zip> <billTo country="US"> <name>Robert Smith</name> <street>8 Oak Avenue</street> <city>Old Town</city> <state>PA</state> <zip>95819</zip> </billTo> </purchaseOrder> ' HTTP/1.1 200 OK Date: Tue, 10 Jul 2018 18:11:54 GMT Content-Type: application/json Content-Length: 249 Connection: keep-alive { "valid" : "false", "message" : "1. org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 16; cvc-complex-type.2.4.a: Invalid content was found starting with element 'name'. One of '{\"http://tempuri.org/po.xsd\":shipTo}' is expected." }
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |