Author |
Message
|
Partha.Baidya |
Posted: Thu Aug 04, 2016 9:53 am Post subject: Debugging element level parsing error for MRM parser |
|
|
 Voyager
Joined: 05 Nov 2009 Posts: 97
|
I am using ASBITSTREM function to validate a XML message against a message Set.
The xsd validation is failed. I took a usertrace.
User trace is has below error.
Quote: |
A schema validation error has occurred while validating the message tree . The content of element "SchData" is not complete.
|
I know that an element of root element "SchData" has problem.
But which element has problem is not showing in Debugger or in user trace.
Could you please let me know how can I view element level parsing error?
I am using MRM domain and not DFDL. |
|
Back to top |
|
 |
Armageddon123 |
Posted: Thu Aug 04, 2016 9:57 am Post subject: |
|
|
Acolyte
Joined: 11 Feb 2014 Posts: 61
|
usertrace normally shows
in debugger, see the previous element which parsed proper value in debug tree. See againist the msgset/lib and you get the problem element |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Aug 04, 2016 10:18 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Are you using the MRM Parser for an XML Message?
If so why? Did someone tell you to do it that way?
Why aren't you using the XMLNSC parser? IT is far more uptodate, faster and more standards compliant.
Please get used to using usertace and not just the debugger. This applies especially for DFDL message parsing. There is information in the tracefile that you won't see in the debugger windows. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Partha.Baidya |
Posted: Thu Aug 04, 2016 12:13 pm Post subject: |
|
|
 Voyager
Joined: 05 Nov 2009 Posts: 97
|
We are using XMLNSC parser not MRM.
This flow is developed in WMB v7. So DFDL was not there. This message set was created using SAP adapter so XSD is not available.
I checked the user trace and it has the below information only.
Quote: |
BIP5026E: XML schema validation error: 'Unexpected end element event. The content of element "SapSchData" is not complete.' Element: '/Root/XMLNSC' Internal error codes: 5011, 2. Line: 1, Column: 1780
This error was reported by the XMLNSC parser. The message tree is not valid according to the message definitions in the message set.
The message tree is not valid according to the message definition files in the message set.
- Check that the elements and attributes in the message tree are declared in the message set.
- Check that all attributes in the message tree have been cast as (XMLNSC.Attribute) in the message tree.
- Check that any values of types gDate, gYear, gMonth, gDay, gYearMonth, gMonthDay have been cast as (XMLNSC.gDate), (XMLNSC.gYear) and so on, in the message tree.
- Check that any values of type base64Binary have been cast as (XMLNSC.base64Binary) in the message tree. |
User trace is not giving the information about which element has validation issue.
I am looking if we can find the element having validation issue by debugger/user trace/service trace.
But no where the error captured. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Aug 04, 2016 12:48 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Partha.Baidya wrote: |
We are using XMLNSC parser not MRM. |
So what did you mean when you said:
Partha.Baidya wrote: |
I am using MRM domain |
in your original post?
Partha.Baidya wrote: |
User trace is not giving the information about which element has validation issue. |
So what's this:
Partha.Baidya wrote: |
The content of element "SapSchData" is not complete. |
A cunning bluff by the broker? Likewise:
Partha.Baidya wrote: |
But no where the error captured. |
So again:
Partha.Baidya wrote: |
BIP5026E: XML schema validation error: 'Unexpected end element event. The content of element "SapSchData" is not complete.' Element: '/Root/XMLNSC' Internal error codes: 5011, 2. Line: 1, Column: 1780 |
Looks like an error to me.
Partha.Baidya wrote: |
I am looking if we can find the element having validation issue by debugger/user trace/service trace. |
Well call me crazy but I'm going to go out on a limb and say it's the complex element called "SapSchData" that's got the validation issue. I'll further risk my reputation (such as it is) that the issue is connected to that complex element missing 1 or more mandatory items.... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Partha.Baidya |
Posted: Thu Aug 04, 2016 1:10 pm Post subject: |
|
|
 Voyager
Joined: 05 Nov 2009 Posts: 97
|
Quote: |
Well call me crazy but I'm going to go out on a limb and say it's the complex element called "SapSchData" that's got the validation issue. I'll further risk my reputation (such as it is) that the issue is connected to that complex element missing 1 or more mandatory items.... |
This is raised by a Customer. If you consider some other tools like WTX or DFDL tool in IIB can tell you that which element is missing.
But in this case the debugger/user trace is not pointing out which element is missing.
The customer question is why WMB does not have details debugging facility.
Could you please suggest what should be a polite answer to make customer happy? |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Aug 04, 2016 10:57 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Partha.Baidya wrote: |
The customer question is why WMB does not have details debugging facility.
Could you please suggest what should be a polite answer to make customer happy? |
WMB does have a debugging facility but it is not meant to be used in production. [1]
However WMB/IIB is intended for use in a 'lights out' eenvironment.
That means that YOU the developer need to create a logging, auditing and error handling framework that will make your job of supporting the site easy. It also needs to fit into the systems already in place at the site.
The error handling framework can process the Exceptionlist and put into say, a DB table the bits that have all the details about the missing or incorrectly formatted element(s).
The original message could be rolled back to a Backout Queue.
etc
etc
etc
finally, have you thought to take the bad message and along with the schema use one of the free online XML Validators and see what is wrong?
As my colleague says, the text of the error message is giving you a string hint as to where the issue lies. You could have solved it yourself by now with a little thought.
[1] There are many people who post here who would like to tar and feather you (or worse) if you suggested using a debugger on their production systems. It is just not done in most places. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
timber |
Posted: Fri Aug 05, 2016 3:39 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
If you consider some other tools like WTX or DFDL tool in IIB can tell you that which element is missing |
It's a fair question. Here's the (non-official) answer:
- DFDL only uses a subset of XML Schema. The advanced features like complex type inheritance, substitution groups, xsi:type are all disallowed. This makes it *far* simpler to match a document against the schema.
- WTX is not an XSD-compliant validator unless you use a special mode ( at least, it wasn't the last time I checked). So you may have to choose between standards-compliant validation and good trace output.
- None of the mainstream XSD validators ( Xerces, Saxon etc ) try to specify exactly what is wrong in the XML document. There are two reasons for this.
1. It is not possible in the general case, because of the advanced features mentioned above
2. It could be done for simple schemas, but those are easy to debug anyway.
So all mainstream XML validators follow the same approach: stop at the first error, and quote the unique ID of the relevant validation rule from the XML Schema specification.
To diagnose 'Unexpected end element'. Start at the last element that was successfully parsed, and check that all of the mandatory elements after it ( within the same complex type ) are included in the XML document. Why is that difficult? I did it 4 times in the past week, on a fairly complex schema. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 05, 2016 5:00 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Partha.Baidya wrote: |
The customer question is why WMB does not have details debugging facility.
Could you please suggest what should be a polite answer to make customer happy? |
Tell your customer to feed the XML & XSD to XMLSpy and see what error message they get when they push the "Validation" button.
To save you some time, it's this:
Code: |
One or more mandatory elements are missing from "<name>" |
You'll also see a similar error buried in a ton of Java stack if you try and parse invalid XML in JAXB or whatever it is. All parsers (like most compilers) report the point where they gave up. It's often not possible to automatically determine root cause.
In your position I'd tell your Customer that if they can find a product with a better XML parser and better parser error reporting then they should be using it. I'd then wish them good luck in their search as XMLNSC is the best in the business (@timber I hope you're blushing).
No, let's be honest, in your position I'd tell your Customer that it's unreasonable to expect the product to hold their hands & wipe their noses (or other areas) every time there's an issue and their Support people just need to suck it up and learn to diagnose a problem rather than be spoon fed the answers.
Yes, I would say that. Yes, that is how I speak politely to Customers.
Yes, the coffee machine is still broken. But I talk like that even when caffeinated. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Partha.Baidya |
Posted: Fri Aug 05, 2016 6:56 am Post subject: |
|
|
 Voyager
Joined: 05 Nov 2009 Posts: 97
|
To everybody, We have found the cause of the issue while debugging. We knew that there is mandatory field missing in the input xml.
Unfortunately in this case WMB developer do not have the XSD because the message set was created using SAP Adapter Connection Wizard.
We could have use XML editor like Altova to find out the issue with XSD & XML. But XSD is not available in this case.
My post was not for assisting me in debugging rather than I wanted to know if WMB has the option to debug this kind of issue.
I was curious to know whether WMB could give any option to detect a XSD validation issue within its boundary of available tool set. Because when I debate with other people who are familiar with Java/other EAI products I need to convey the message that WMB will be a better option compare to other products.
If I say use Altova then it looks WMB is lacking and customer needs to buy Altova as well. May customer dislike this.
@Vitor, @timber
Thanks for your valuable replies and insider view of the issue. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Aug 05, 2016 7:00 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If you tell IIB to use the XSD as the model, and then you send it a message that doesn't conform, IIB will tell you that the message doesn't conform.
If you want to do this without sending a message to IIB, you can probably find an Eclipse tool that will do this, likely free, that you can install in your IIB Toolkit.
Usually, though, it's the job of the sender of the message to ensure that they are conforming to the XSD. So if there was a missing required field, then SAP should have not allowed that message to be sent. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Fri Aug 05, 2016 7:46 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
If you tell IIB to use the XSD as the model, and then you send it a message that doesn't conform, IIB will tell you that the message doesn't conform. |
And indeed, that's exactly what it was telling you.
mqjeff wrote: |
Usually, though, it's the job of the sender of the message to ensure that they are conforming to the XSD. So if there was a missing required field, then SAP should have not allowed that message to be sent. |
In most use cases the XSD is the basis of the contract the receiver makes with the sender. If the XML doesn't match the XSD then it's the responsibility of the sender to make good, not the receiver to figure out what's wrong and/or handle the bad XML.
Partha.Baidya wrote: |
Unfortunately in this case WMB developer do not have the XSD because the message set was created using SAP Adapter Connection Wizard |
The WMB Developer should not have been involved in this, as indeed the WMB (as the receiver) should have had minimal involvement in debugger. It's not a problem with WMB or the code deployed to it; it's a problem with the XML being sent that should have been diagnosed from the SAP side.
Partha.Baidya wrote: |
Because when I debate with other people who are familiar with Java/other EAI products I need to convey the message that WMB will be a better option compare to other products. |
As I indicated above, any other product or a JAXB parser would choke on this kind of bad XML and will not produce materially better diagnostic data.
They fixed the machine  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|