IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

XML Validation

  • 1.  XML Validation

    Posted Sat April 10, 2004 01:16 AM

    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


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 2.  RE: XML Validation

    Posted Sat April 10, 2004 02:28 AM

    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,


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: XML Validation

    Posted Sun April 11, 2004 10:12 PM

    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.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 4.  RE: XML Validation

    Posted Mon April 12, 2004 04:54 PM

    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.


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 5.  RE: XML Validation

    Posted Mon June 21, 2004 02:53 PM

    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,


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 6.  RE: XML Validation

    Posted Mon June 21, 2004 05:10 PM

    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


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 7.  RE: XML Validation

    Posted Mon June 21, 2004 05:17 PM

    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.


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 8.  RE: XML Validation

    Posted Mon June 21, 2004 05:20 PM

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


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 9.  RE: XML Validation

    Posted Mon June 21, 2004 05:27 PM

    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)


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 10.  RE: XML Validation

    Posted Mon June 21, 2004 06:48 PM

    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


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 11.  RE: XML Validation

    Posted Mon June 21, 2004 07:00 PM

    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 [url=“XML Schema”]http://www.w3.org/2001/XMLSchema[/url]" to [url=“http://www.w3.org/1999/XMLSchema”]http://www.w3.org/1999/XMLSchema[/url]" in the Schema and load it again.

    I will let you know if any clue.

    HTH,


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 12.  RE: XML Validation

    Posted Mon June 21, 2004 07:27 PM

    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]

    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 13.  RE: XML Validation

    Posted Mon June 21, 2004 07:40 PM

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

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


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 14.  RE: XML Validation

    Posted Thu June 24, 2004 11:47 PM

    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


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 15.  RE: XML Validation

    Posted Thu June 24, 2004 11:48 PM

    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


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 16.  RE: XML Validation

    Posted Thu June 24, 2004 11:54 PM

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


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB