ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Schema Validation after XML Tranformation node

Post new topic  Reply to topic
 Schema Validation after XML Tranformation node « View previous topic :: View next topic » 
Author Message
asalema
PostPosted: Mon Oct 02, 2006 10:28 am    Post subject: Schema Validation after XML Tranformation node Reply with quote

Apprentice

Joined: 05 May 2003
Posts: 35

Hi All,

I have a flow as follows:

HTTPInput->XMLTransformation node->Javacompute(Schema Validation using Xerces)->HTTPReply

The javacompute node simply validates the incoming message against a schema file on the file system using a static function

Here is the code for the javacompute
Code:

   public void evaluate(MbMessageAssembly contact admin) throws MbException {
      MbOutputTerminal out = getOutputTerminal("out");
      MbOutputTerminal alt = getOutputTerminal("alternate");
.....................................
      //Obtain the bitstream of the message body, i.e. the last element of the message
      byte[] bitstream = contact admin.getMessage().getRootElement().getLastChild().toBitstream(null,null,null,0,0,0);
      //Convert the byte array into a string.
      String bitstreamText = new String(bitstream, "UTF-8");
      schemaLocation = "http://ephsprj.org/GetPersonDemographicsBO /ephs/schemas/EPHS_GetPersonDemographics_WSBO.xsd";
problem====>    ParserUtil.parseString( bitstreamText, true, schemaLocation );     
............................................
}


ParserUtil.parseString is a static function with the following code
Code:

  static private DOMParser EPHSParser = new DOMParser();
  public static Document parseString( String xmlString, boolean validation, String schemaLocation ) throws Exception {
    return parse( new InputSource( new StringReader( xmlString ) ), validation, schemaLocation );
  }

  public static Document parse ( InputSource inputSource, boolean validation,
    String schemaLocation ) throws Exception {

   
    //DOMParser parser = new DOMParser();
     EPHSParser.setFeature("http://xml.org/sax/features/validation", validation );
    if (schemaLocation != null)
    {
       EPHSParser.setFeature("http://apache.org/xml/features/validation/schema",true);
       EPHSParser.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",
        schemaLocation);
    }
    ErrorHolder errHolder = new ErrorHolder();
    EPHSParser.setErrorHandler( new ParserErrorHandler(errHolder) );
    EPHSParser.parse( inputSource );

    Document doc = EPHSParser.getDocument();
    if ( errHolder.isError() ) {// add exception with the source of the XML file
      throw new ErrorHolderException( errHolder );
    }
    return doc;
  }


The transformation part is straightforward copy of the message plus some business validation for some elements and it always works fine.

Now, if I call the validation after the transformation, I always get this exception the first time I deploy the message flow
Code:

java.lang.ExceptionInInitializerError
        at com.ibm.ephsesb.mb.java.validation.EPHS_validateMsg_JavaCompute.validate(EPHS_validateMsg_JavaCompute.java:34)
        at com.ibm.ephsesb.mb.java.validation.EPHS_validateMsg_JavaCompute.evaluate(EPHS_validateMsg_JavaCompute.java:133)
        at com.ibm.broker.javacompute.MbRuntimeJavaComputeNode.evaluate(MbRuntimeJavaComputeNode.java:105)
        at com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1222)
        at com.ibm.broker.plugin.MbOutputTerminal._propagate(Native Method)
        at com.ibm.broker.plugin.MbOutputTerminal.propagate(MbOutputTerminal.java:140)
        at com.ibm.xsl.mqsi.XMLTransformNode.evaluate(XMLTransformNode.java:1017)
        at com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1222)
Caused by: java.lang.ClassCastException: org.apache.xerces.parsers.XML11Configuration
        at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
        at org.apache.xerces.parsers.DOMParser.<init>(Unknown Source)
        at com.ibm.ephsesb.mb.java.xmlvalidation.ParserUtil.<clinit>(ParserUtil.java:72)
        ... 8 more

then I get "EPHS_validateMsg_JavaCompute NoClassDefFoundError" if I try the same message again, cause the class did not initialize correctly

Strangely enough, if the transformation fails for some reason, the validation works fine
Yet more strangely, if I move the JavaCompute node "before" the XMLtransformation, the validation always works fine. Same thing, if I put validation before and after transformation. So, once transformation happens correctly, I cannot validate any more.

This indicates, that apparantly the DOMParser used by the ParserUtil class, some how, conflicts with the similar class used by the XMLTranformation node. Although, they both should be using the same Xerces library which is part of the MessageBroker.

I would highly appreciate any guidance as I have been working on this problem for more than 3 days now.

Best Regards,
Back to top
View user's profile Send private message
XZ
PostPosted: Tue Oct 03, 2006 2:49 am    Post subject: Reply with quote

Apprentice

Joined: 22 May 2006
Posts: 45
Location: IBM Hursley

This appears to be a bug. Could you please raise a PMR?
_________________
Regards,

-XZ
WMQI Development
Back to top
View user's profile Send private message
wischlei
PostPosted: Fri Aug 10, 2007 4:16 am    Post subject: Problem resolved Reply with quote

Novice

Joined: 11 Feb 2004
Posts: 21
Location: Germany

Hi there,
I seem to have the same problem (XML Transformation -> XML Validation Node -> Exception) with a 6.0.0.2/6.0.0.3 broker on AIX and Windows. Has it been resolved?
Regards
Winfried Schleipen
_________________
Winfried Schleipen
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Schema Validation after XML Tranformation node
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.