XML Validation

Hi All,
How do we validate a XML message without using stringtoDocument and documenttorecord in IS 4.6?
In our application I need to validate the xml against a DTD.If i happen to send a malformed xml…it fails at documenttoRecord.
How do i handle this?

TIA

Use the WmPublic service (pub.schema:validate) and set conformsTo parameter with record strucure name or schema name(fullyqualified name)along with xml data.This will validate the xml against schema.

Also check the builtin services pdf, regarding more info for using this service.

Regards,

One of the things I like about the way IS does validation is that the parser just does XML syntax validation (the minimal amount of validation it can do to create a parse tree). All DTD/XSD or pipeline validation is done in layers above the parser, allowing the application level to decide how to handle schema errors.

If your XML is so bad it fails documentToRecord then no parser would be able to create a parse tree from it, but since the default mode of the Integration Server XML parser is streaming (true since 3.0), even the parse errors are often delayed until the application server has control.

How you handle it is up to what you want your application behavior to be. If you want to return a specific different error for XML syntax errors and schema validation errors you can. You could try to recover from certain schema validation errors. Or call pub.schema:validate on the xmlNode and make sure everything is OK.

Also…

If your starting point is a string, I would think the failure occurs at the stringToDocument step?

Regardless, you can put your validation logic within a “try-catch” to handle the service exception in the event you have malformed xml.

I personally prefer schema based validation over record based validation. This may be overkill in your specific situation, but I have found that with complex schemas, the wm schema validation is more robust.

kris,

If possible can you upload the Schema that you are trying to load in the IS?so that we can get close view.

HTH,

I am sorry that i have to upload it as messsage .I am uploading it as an attachment . please review and let me know what could be the problem.

xsd file
ApplicationBase1.1.xsd (24.3 k)

cheers
Kris

Kris,

Thanks for posting with file.
But when i tried to load this schema its not loading properly.probably this site is making some thing parameters missing in the schema data like <?xml> (end ? mark is missing which i added when loading)

So try to load yourschema.xsd as a file Attachment using the Upload Attachment option provided in this site.

Thanks kris for sending an attachment,I will check it.

Kris,

Unfortunately i dont have IS4.6 installed.But i tested this schema in 6.01 with minor change in the Schema for minlengh=1 for ReferencePO error.

Download this attachment and load this schema and test it.

ChangedSchema
ApplicationBase1_1-36207.unk (24.3 k)

RMG,
I am facing a little problem with the ones with the datatype as double and wcdatatime, wcdate wc double datatypes. Please let me know if there is any fix that we need to install or a patch that we need to install for these. I already made WCID as minlength=o so that error went off. I think it is some problem with the b2b server .
Cheers
Kris

In the IS6.01server this schema is loading properly without any errors or warnings and even it is showing well in the IE.
But i am not sure why these dataypes causing error in 4.6.The reason might be schema year compatible issue in 4.6.

So try changing the http://www.w3.org/2001/XMLSchema" to http://www.w3.org/1999/XMLSchema" in the Schema and load it again.

I will let you know if any clue.

HTH,

Kris,

Try loading this schema.

I have made change the WCDate pattern (yyyy-mm-ddTHH:mm:ss),WCDouble of
minInclusive value=“0” to minInclusive value=“0.0” and reverted back to 2001 schema.

[img]http://www.wmusers.com/wmusers/icons/attachment_icon.gif[/img] 24.3 K ApplicationBase1_1-36207-36210.unk [b]"ChangedSchema"[/b]

Here is the Attachment which was missed in the previous post.

modifiedSchema
ApplicationBase1_1-36207-36210.unk (24.3 k)

Hai RMG,
Thankyou for the help I appreciate it . we have opened a ticket with the webMethods and it seems there in no way to parse the elements with datatype as string in the IS 4.6 we are trying to write a java service to validate the xml structure.
I will post if anything comes up
Kris

Hai RMG,
Thankyou for the help I appreciate it . we have opened a ticket with the webMethods and it seems there in no way to parse the elements with datatype as double or date in the IS 4.6 we are trying to write a java service to validate the xml structure. they fixed it in 6.0.
I will post if anything comes up
Kris

Thanks for the update…
So they might have enhanced from 6.0 version so it is parsing well when i create on IS6.01.